Authored by 郭成尧

shop-intro

@@ -13,6 +13,7 @@ const headerModel = require('../../../doraemon/models/header'); @@ -13,6 +13,7 @@ const headerModel = require('../../../doraemon/models/header');
13 const _ = require('lodash'); 13 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 17
17 18
18 /** 19 /**
@@ -381,8 +382,9 @@ const shop = { @@ -381,8 +382,9 @@ const shop = {
381 let banner = _.get(valArr[0], 'data.banner'); 382 let banner = _.get(valArr[0], 'data.banner');
382 383
383 let brand = _.get(valArr[1], 'data[0]', {}); 384 let brand = _.get(valArr[1], 'data[0]', {});
384 - let introData = valArr[2];  
385 - let decoratorsData = valArr[3]; 385 + let shopIntro = redShopPrcs.shopIntro(_.get(valArr[2], 'data', {}));
  386 +
  387 + let decoratorsData = redShopPrcs.floor(_.get(valArr[3], 'data.modules', []));
386 388
387 res.render('newshop/shop-reds', { 389 res.render('newshop/shop-reds', {
388 pageHeader: headerModel.setNav({ 390 pageHeader: headerModel.setNav({
@@ -393,7 +395,7 @@ const shop = { @@ -393,7 +395,7 @@ const shop = {
393 module: 'product', 395 module: 'product',
394 page: 'reds-shop', 396 page: 'reds-shop',
395 shopId, 397 shopId,
396 - banner, brand, introData, decoratorsData, 398 + banner, brand, shopIntro, decoratorsData,
397 time3: [0, 1, 2] 399 time3: [0, 1, 2]
398 }); 400 });
399 }).catch(next); 401 }).catch(next);
@@ -13,19 +13,22 @@ @@ -13,19 +13,22 @@
13 <h1 class="shopname">{{brand.brand_name}}</h1> 13 <h1 class="shopname">{{brand.brand_name}}</h1>
14 <div class="favs">粉丝数: 534 <i class="iconfont favs-btn like">&#xe605;</i></div> 14 <div class="favs">粉丝数: 534 <i class="iconfont favs-btn like">&#xe605;</i></div>
15 </div> 15 </div>
  16 + {{#shopIntro}}
16 <div class="shop-intro"> 17 <div class="shop-intro">
17 - <div class="line-clamp-2">这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍这里是介绍</div> 18 + <div id="shortIntro" class="line-clamp-2">{{{short_intro}}}</div>
  19 + <div id="shopIntro" class="hide">{{{shop_intro}}}</div>
18 <div class="shop-intro-folder"> 20 <div class="shop-intro-folder">
19 - <i class="iconfont">&#xe616;</i> 21 + <i id="shopIntrArrw" class="iconfont">&#xe616;</i>
20 </div> 22 </div>
21 </div> 23 </div>
  24 + {{/shopIntro}}
22 </div> 25 </div>
23 </div> 26 </div>
24 - {{!--shop-tab-nav: 红人首页 | 全部商品--}} 27 + {{!--shop-tab-nav: 首页 | 全部商品--}}
25 <div class="tab"> 28 <div class="tab">
26 <ul class="shop-tabs tab-navs" data-sticky> 29 <ul class="shop-tabs tab-navs" data-sticky>
27 <li class="shop-tab-nav tab-nav active"> 30 <li class="shop-tab-nav tab-nav active">
28 - <a href="#red-index" data-trigger="tab" data-funFilterHide>红人首页</a> 31 + <a href="#red-index" data-trigger="tab" data-funFilterHide>首页</a>
29 </li> 32 </li>
30 <em>|</em> 33 <em>|</em>
31 <li class="shop-tab-nav tab-nav"> 34 <li class="shop-tab-nav tab-nav">
@@ -39,31 +42,13 @@ @@ -39,31 +42,13 @@
39 {{> common/filter}} 42 {{> common/filter}}
40 </div> 43 </div>
41 <div class="tab-panels"> 44 <div class="tab-panels">
42 - {{!--shop-tab: 红人首页--}} 45 + {{!--shop-tab: 首页--}}
43 <div id="red-index" class="tab-panel active"> 46 <div id="red-index" class="tab-panel active">
44 <div class="shop-coupon coupon-group"></div> 47 <div class="shop-coupon coupon-group"></div>
45 - {{!--<div class="shop-coupon coupon-content">  
46 - {{#each time3}}  
47 - <div class="coupon-small">  
48 - <div class="coupon-left">  
49 - <span class="coupon-left-price">  
50 - <span class="coupon-sign">¥</span>  
51 - <span class="coupon-price">88</span>  
52 - </span>  
53 - <span class="coupon-left-name">  
54 - VANS圣诞礼券:满588减88  
55 - </span>  
56 - </div>  
57 - <div class="coupon-right receive-btn">  
58 - 立即领取  
59 - </div>  
60 - </div>  
61 - {{/each}}  
62 - </div>--}} 48 +
  49 + {{!-- CarouselImage --}}
63 <div class="shop-swiper"> 50 <div class="shop-swiper">
64 -  
65 </div> 51 </div>
66 -  
67 {{!--视频--}} 52 {{!--视频--}}
68 <div class="shop-video shop-section"> 53 <div class="shop-video shop-section">
69 <header> 54 <header>
@@ -3,9 +3,10 @@ require('product/shop/redshop.page.css'); @@ -3,9 +3,10 @@ require('product/shop/redshop.page.css');
3 3
4 require('../plugin/sticky'); 4 require('../plugin/sticky');
5 require('./shop/coupon'); 5 require('./shop/coupon');
  6 +require('./shop/red-shop');
6 7
  8 +const $ = require('jquery');
7 const allProduct = require('./shop/all-product'); 9 const allProduct = require('./shop/all-product');
8 -  
9 let Tab = require('../plugin/tab'); 10 let Tab = require('../plugin/tab');
10 11
11 let $filterBox = $('.filter-box'); 12 let $filterBox = $('.filter-box');
  1 +/*
  2 + * @Author: Targaryen
  3 + * @Date: 2017-03-23 11:31:51
  4 + * @Last Modified by: Targaryen
  5 + * @Last Modified time: 2017-03-23 14:32:21
  6 + */
  7 +/* 红人店铺首页 */
  8 +
  9 +let $shopIntroFolder = $('.shop-intro-folder');
  10 +let $shortIntro = $('#shortIntro');
  11 +let $shopIntro = $('#shopIntro');
  12 +let $shopIntrArrw = $('#shopIntrArrw');
  13 +
  14 +/**
  15 + * 店铺介绍展开收起
  16 + */
  17 +$shopIntroFolder.on('click', function() {
  18 + $shortIntro.toggleClass('hide');
  19 + $shopIntro.toggleClass('active');
  20 +
  21 + if ($shopIntro.hasClass('active')) {
  22 + $shopIntrArrw.html('&#xe615;');
  23 + } else {
  24 + $shopIntrArrw.html('&#xe616;');
  25 + }
  26 +});
@@ -43,6 +43,14 @@ @@ -43,6 +43,14 @@
43 .shop-intro { 43 .shop-intro {
44 font-size: 28px; 44 font-size: 28px;
45 color: #444; 45 color: #444;
  46 +
  47 + .hide {
  48 + display: none;
  49 + }
  50 +
  51 + .active {
  52 + display: block;
  53 + }
46 } 54 }
47 55
48 .shop-intro-folder { 56 .shop-intro-folder {
  1 +/*
  2 + * @Author: Targaryen
  3 + * @Date: 2017-03-23 11:02:31
  4 + * @Last Modified by: Targaryen
  5 + * @Last Modified time: 2017-03-23 14:19:26
  6 + */
  7 +/* 红人店铺数据处理 */
  8 +
  9 +const _ = require('lodash');
  10 +
  11 +/**
  12 + * 红人店铺楼层数据处理工具
  13 + */
  14 +const _tools = {
  15 + carouselImage(data) {
  16 + return data;
  17 + },
  18 + title(data) {
  19 + return data;
  20 + },
  21 + singleImage(data) {
  22 + return data;
  23 + },
  24 + doubleImage(data) {
  25 + return data;
  26 + },
  27 + tripleImage(data) {
  28 + return data;
  29 + },
  30 + sknList(data) {
  31 + return data;
  32 + }
  33 +};
  34 +
  35 +/**
  36 + * 处理红人店铺楼层
  37 + * @param {*} decoratorsData
  38 + */
  39 +const floor = (decoratorsData) => {
  40 + let finalData = [];
  41 +
  42 + _.forEach(decoratorsData, value => {
  43 + switch (value.module_type) {
  44 + case 'CarouselImage':
  45 + finalData.push(_tools.carouselImage(value.data));
  46 + break;
  47 + case 'Title':
  48 + finalData.push(_tools.title(value.data));
  49 + break;
  50 + case 'SingleImage':
  51 + finalData.push(_tools.singleImage(value.data));
  52 + break;
  53 + case 'DoubleImage':
  54 + finalData.push(_tools.doubleImage(value.data));
  55 + break;
  56 + case 'TripleImage':
  57 + finalData.push(_tools.tripleImage(value.data));
  58 + break;
  59 + case 'SknList':
  60 + finalData.push(_tools.sknList(value.data));
  61 + break;
  62 + default:
  63 + break;
  64 + }
  65 + });
  66 +
  67 + return finalData;
  68 +};
  69 +
  70 +const shopIntro = (params) => {
  71 + if (params) {
  72 + params.short_intro = _.get(params, 'shop_intro', '').replace(/<.*?>/g, '');
  73 + }
  74 +
  75 + return params;
  76 +};
  77 +
  78 +module.exports = {
  79 + floor,
  80 + shopIntro
  81 +};