Authored by 郭成尧

shop-intro

... ... @@ -13,6 +13,7 @@ const headerModel = require('../../../doraemon/models/header');
const _ = require('lodash');
const helpers = global.yoho.helpers;
const productProcess = require(`${utils}/product-process`);
const redShopPrcs = require(`${utils}/redshop-process`);
/**
... ... @@ -381,8 +382,9 @@ const shop = {
let banner = _.get(valArr[0], 'data.banner');
let brand = _.get(valArr[1], 'data[0]', {});
let introData = valArr[2];
let decoratorsData = valArr[3];
let shopIntro = redShopPrcs.shopIntro(_.get(valArr[2], 'data', {}));
let decoratorsData = redShopPrcs.floor(_.get(valArr[3], 'data.modules', []));
res.render('newshop/shop-reds', {
pageHeader: headerModel.setNav({
... ... @@ -393,7 +395,7 @@ const shop = {
module: 'product',
page: 'reds-shop',
shopId,
banner, brand, introData, decoratorsData,
banner, brand, shopIntro, decoratorsData,
time3: [0, 1, 2]
});
}).catch(next);
... ...
... ... @@ -13,19 +13,22 @@
<h1 class="shopname">{{brand.brand_name}}</h1>
<div class="favs">粉丝数: 534 <i class="iconfont favs-btn like">&#xe605;</i></div>
</div>
{{#shopIntro}}
<div class="shop-intro">
<div class="line-clamp-2">这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍</div>
<div id="shortIntro" class="line-clamp-2">{{{short_intro}}}</div>
<div id="shopIntro" class="hide">{{{shop_intro}}}</div>
<div class="shop-intro-folder">
<i class="iconfont">&#xe616;</i>
<i id="shopIntrArrw" class="iconfont">&#xe616;</i>
</div>
</div>
{{/shopIntro}}
</div>
</div>
{{!--shop-tab-nav: 红人首页 | 全部商品--}}
{{!--shop-tab-nav: 首页 | 全部商品--}}
<div class="tab">
<ul class="shop-tabs tab-navs" data-sticky>
<li class="shop-tab-nav tab-nav active">
<a href="#red-index" data-trigger="tab" data-funFilterHide>红人首页</a>
<a href="#red-index" data-trigger="tab" data-funFilterHide>首页</a>
</li>
<em>|</em>
<li class="shop-tab-nav tab-nav">
... ... @@ -39,31 +42,13 @@
{{> common/filter}}
</div>
<div class="tab-panels">
{{!--shop-tab: 红人首页--}}
{{!--shop-tab: 首页--}}
<div id="red-index" class="tab-panel active">
<div class="shop-coupon coupon-group"></div>
{{!--<div class="shop-coupon coupon-content">
{{#each time3}}
<div class="coupon-small">
<div class="coupon-left">
<span class="coupon-left-price">
<span class="coupon-sign">¥</span>
<span class="coupon-price">88</span>
</span>
<span class="coupon-left-name">
VANS圣诞礼券:满588减88
</span>
</div>
<div class="coupon-right receive-btn">
立即领取
</div>
</div>
{{/each}}
</div>--}}
{{!-- CarouselImage --}}
<div class="shop-swiper">
</div>
{{!--视频--}}
<div class="shop-video shop-section">
<header>
... ...
... ... @@ -3,9 +3,10 @@ require('product/shop/redshop.page.css');
require('../plugin/sticky');
require('./shop/coupon');
require('./shop/red-shop');
const $ = require('jquery');
const allProduct = require('./shop/all-product');
let Tab = require('../plugin/tab');
let $filterBox = $('.filter-box');
... ...
/*
* @Author: Targaryen
* @Date: 2017-03-23 11:31:51
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-23 14:32:21
*/
/* 红人店铺首页 */
let $shopIntroFolder = $('.shop-intro-folder');
let $shortIntro = $('#shortIntro');
let $shopIntro = $('#shopIntro');
let $shopIntrArrw = $('#shopIntrArrw');
/**
* 店铺介绍展开收起
*/
$shopIntroFolder.on('click', function() {
$shortIntro.toggleClass('hide');
$shopIntro.toggleClass('active');
if ($shopIntro.hasClass('active')) {
$shopIntrArrw.html('&#xe615;');
} else {
$shopIntrArrw.html('&#xe616;');
}
});
... ...
... ... @@ -43,6 +43,14 @@
.shop-intro {
font-size: 28px;
color: #444;
.hide {
display: none;
}
.active {
display: block;
}
}
.shop-intro-folder {
... ...
/*
* @Author: Targaryen
* @Date: 2017-03-23 11:02:31
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-23 14:19:26
*/
/* 红人店铺数据处理 */
const _ = require('lodash');
/**
* 红人店铺楼层数据处理工具
*/
const _tools = {
carouselImage(data) {
return data;
},
title(data) {
return data;
},
singleImage(data) {
return data;
},
doubleImage(data) {
return data;
},
tripleImage(data) {
return data;
},
sknList(data) {
return data;
}
};
/**
* 处理红人店铺楼层
* @param {*} decoratorsData
*/
const floor = (decoratorsData) => {
let finalData = [];
_.forEach(decoratorsData, value => {
switch (value.module_type) {
case 'CarouselImage':
finalData.push(_tools.carouselImage(value.data));
break;
case 'Title':
finalData.push(_tools.title(value.data));
break;
case 'SingleImage':
finalData.push(_tools.singleImage(value.data));
break;
case 'DoubleImage':
finalData.push(_tools.doubleImage(value.data));
break;
case 'TripleImage':
finalData.push(_tools.tripleImage(value.data));
break;
case 'SknList':
finalData.push(_tools.sknList(value.data));
break;
default:
break;
}
});
return finalData;
};
const shopIntro = (params) => {
if (params) {
params.short_intro = _.get(params, 'shop_intro', '').replace(/<.*?>/g, '');
}
return params;
};
module.exports = {
floor,
shopIntro
};
... ...