Authored by 郭成尧

sknlist

... ... @@ -14,7 +14,7 @@ const _ = require('lodash');
const helpers = global.yoho.helpers;
const productProcess = require(`${utils}/product-process`);
const redShopPrcs = require(`${utils}/redshop-process`);
const co = require('bluebird').coroutine;
/**
* 从 useragent 获取 uid
... ... @@ -388,17 +388,16 @@ const shop = {
redShop(req, res, next) {
let shopId = req.query.shop_id || 792; // test3
Promise.all([
redsShopModel.getBanner(shopId), // 0: 获取红人店 banner
redsShopModel.getShopsBrands(shopId), // 1: 获取店铺品牌数据
redsShopModel.getIntro(shopId), // 2. 获取店铺介绍
redsShopModel.getShopsdecorator(shopId) // 3. 获取店铺装修元素
]).then(valArr => {
let banner = _.get(valArr[0], 'data.banner');
co(function* () {
let bannerData = yield redsShopModel.getBanner(shopId);
let brandData = yield redsShopModel.getShopsBrands(shopId);
let shopIntroData = yield redsShopModel.getIntro(shopId);
let decoratorsData = yield redsShopModel.getShopsdecorator(shopId);
let brand = _.get(valArr[1], 'data[0]', {});
let shopIntro = redShopPrcs.shopIntro(_.get(valArr[2], 'data', {}));
let decoratorsData = redShopPrcs.floor(_.get(valArr[3], 'data.modules', []));
let banner = _.get(bannerData, 'data.banner');
let brand = _.get(brandData, 'data[0]', {});
let shopIntro = redShopPrcs.shopIntro(_.get(shopIntroData, 'data', {}));
let decorators = redShopPrcs.floor(_.get(decoratorsData, 'data.modules', []));
res.render('newshop/shop-reds', {
pageHeader: headerModel.setNav({
... ... @@ -409,11 +408,9 @@ const shop = {
module: 'product',
page: 'reds-shop',
shopId,
banner, brand, shopIntro, decoratorsData,
time3: [0, 1, 2]
banner, brand, shopIntro, decorators
});
}).catch(next);
})().catch(next);
},
/**
... ...
{{#each decoratorsData}}
{{#each decorators}}
{{#isEqual module_type 'Title'}}
<header class="section-header">
<i class="section-more iconfont">&#xe606;</i>
... ... @@ -47,15 +47,13 @@
</div>
{{/isEqual}}
{{#isEqual module_type 'TripleImage'}}
<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}}">
<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}}">
{{#each ../pics}}
{{> reds-shop/item}}
{{/each}}
</div>
{{/isEqual}}
{{#isEqual module_type 'SknList'}}
<div class="goods-container" data-skns="{{../skns}}"></div>
{{/isEqual}}
{{/each}}
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-23 11:31:51
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-23 18:37:04
* @Last Modified time: 2017-03-24 16:17:00
*/
/* 红人店铺首页 */
const Swiper2 = require('yoho-swiper2');
... ... @@ -11,6 +11,7 @@ let $shopIntroFolder = $('.shop-intro-folder');
let $shortIntro = $('#shortIntro');
let $shopIntro = $('#shopIntro');
let $shopIntrArrw = $('#shopIntrArrw');
let $goodsContainer = $('.goods-container');
/**
* 店铺介绍展开收起
... ... @@ -27,6 +28,25 @@ $shopIntroFolder.on('click', function() {
});
/**
* 异步加载人气单品
*/
$.each($goodsContainer, function(index, elem) {
$.ajax({
type: 'GET',
url: location.protocol + '//m.yohobuy.com/product//new/shop/hotlist',
xhrFields: {
withCredentials: true
},
data: {
skns: $(elem).data('skns')
},
success: function(result) {
$(elem).html(result);
}
});
});
/**
* 店铺轮播图
*/
if ($('.shop-swiper')) {
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-23 17:12:53
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-24 11:23:25
* @Last Modified time: 2017-03-24 16:13:11
*/
// 红人店铺首页
... ... @@ -28,63 +28,7 @@
color: #a9a9a9;
float: right;
}
}
.shop-coupon {
background-color: #f0f0f0;
}
.shop-swiper {
height: 234px;
overflow: hidden;
ul {
width: 100%;
}
ul > li {
width: 100%;
}
}
.shop-video {
.video-player {
height: 363px;
}
.video-intro {
padding: 30px;
}
.video-title {
font-size: 36px;
color: #444;
margin-bottom: 30px;
}
.video-desc {
font-size: 28px;
color: #444;
}
.video-poster {
position: relative;
height: 363px;
color: #fff;
}
.video-meta-customers {
position: absolute;
top: 20px;
right: 30px;
font-size: 24px;
padding: 10px 20px;
border-radius: 50px;
background-color: rgba(0, 0, 0, 0.5);
}
}
.red-shop-index {
.item {
position: relative;
}
... ... @@ -212,9 +156,67 @@
background-color: rgba(0, 0, 0, 0.5);
}
}
}
.shop-item-div {
height: 30px;
background-color: #f0f0f0;
.goods-container {
display: inline-block;
}
.shop-coupon {
background-color: #f0f0f0;
}
.shop-swiper {
height: 234px;
overflow: hidden;
ul {
width: 100%;
}
ul > li {
width: 100%;
}
}
.shop-video {
.video-player {
height: 363px;
}
.video-intro {
padding: 30px;
}
.video-title {
font-size: 36px;
color: #444;
margin-bottom: 30px;
}
.video-desc {
font-size: 28px;
color: #444;
}
.video-poster {
position: relative;
height: 363px;
color: #fff;
}
.video-meta-customers {
position: absolute;
top: 20px;
right: 30px;
font-size: 24px;
padding: 10px 20px;
border-radius: 50px;
background-color: rgba(0, 0, 0, 0.5);
}
}
.shop-item-div {
height: 30px;
background-color: #f0f0f0;
}
}
... ...