Authored by 郭成尧

img-link

1 <div class="item"> 1 <div class="item">
2 - <img class="item-pic" src="{{src}}" alt=""> 2 + {{#if link}}
  3 + <a href="{{link}}">
  4 + <img class="item-pic" src="{{src}}" alt="">
  5 + </a>
  6 + {{^}}
  7 + <img class="item-pic" src="{{src}}" alt="">
  8 + {{/if}}
3 <div class="item-info"> 9 <div class="item-info">
4 <div class="">ABCDEFG ABCDEFG</div> 10 <div class="">ABCDEFG ABCDEFG</div>
5 <div> 11 <div>
1 -{{#if ../isModuleMargin}}  
2 - <div class="margin-bottom"></div>  
3 -{{/if}}  
@@ -2,24 +2,33 @@ @@ -2,24 +2,33 @@
2 {{#isEqual module_type 'Title'}} 2 {{#isEqual module_type 'Title'}}
3 <header class="section-header"> 3 <header class="section-header">
4 <div class="section-title">{{../text}}</div> 4 <div class="section-title">{{../text}}</div>
5 - <a class="section-more" href=""><i class="iconfont">&#xe606;</i></a> 5 + {{#if ../link}}
  6 + <a class="section-more" href="{{../link}}"><i class="iconfont">&#xe606;</i></a>
  7 + {{/if}}
6 </header> 8 </header>
7 - {{> reds-shop/margin-bottom}} 9 + {{#if ../isModuleMargin}}
  10 + <div class="margin-bottom"></div>
  11 + {{/if}}
8 {{/isEqual}} 12 {{/isEqual}}
9 {{#isEqual module_type 'CarouselImage'}} 13 {{#isEqual module_type 'CarouselImage'}}
10 <div class="shop-swiper shop-swiper-{{../num}}"> 14 <div class="shop-swiper shop-swiper-{{../num}}">
11 <ul class="swiper-wrapper"> 15 <ul class="swiper-wrapper">
12 {{#each ../pics}} 16 {{#each ../pics}}
13 <li class="swiper-slide"> 17 <li class="swiper-slide">
14 - <a href="{{url}}"> 18 + {{#if link}}
  19 + <a href="{{link}}">
  20 + <img src="{{src}}" alt="">
  21 + </a>
  22 + {{^}}
15 <img src="{{src}}" alt=""> 23 <img src="{{src}}" alt="">
16 - </a> 24 + {{/if}}
17 </li> 25 </li>
18 {{/each}} 26 {{/each}}
19 </ul> 27 </ul>
20 - <div class="swiper-pagination"></div>  
21 </div> 28 </div>
22 - {{> reds-shop/margin-bottom}} 29 + {{#if ../isModuleMargin}}
  30 + <div class="margin-bottom"></div>
  31 + {{/if}}
23 {{/isEqual}} 32 {{/isEqual}}
24 {{#isEqual module_type 'Video'}} 33 {{#isEqual module_type 'Video'}}
25 <div class="shop-video shop-section"> 34 <div class="shop-video shop-section">
@@ -35,7 +44,9 @@ @@ -35,7 +44,9 @@
35 <p class="text-line-2">{{../content}}</p> 44 <p class="text-line-2">{{../content}}</p>
36 </div> 45 </div>
37 </div> 46 </div>
38 - {{> reds-shop/margin-bottom}} 47 + {{#if ../isModuleMargin}}
  48 + <div class="margin-bottom"></div>
  49 + {{/if}}
39 {{/isEqual}} 50 {{/isEqual}}
40 {{#isEqual module_type 'SingleImage'}} 51 {{#isEqual module_type 'SingleImage'}}
41 <div class="items-s1"> 52 <div class="items-s1">
@@ -43,7 +54,9 @@ @@ -43,7 +54,9 @@
43 {{> reds-shop/item}} 54 {{> reds-shop/item}}
44 {{/each}} 55 {{/each}}
45 </div> 56 </div>
46 - {{> reds-shop/margin-bottom}} 57 + {{#if ../isModuleMargin}}
  58 + <div class="margin-bottom"></div>
  59 + {{/if}}
47 {{/isEqual}} 60 {{/isEqual}}
48 {{#isEqual module_type 'DoubleImage'}} 61 {{#isEqual module_type 'DoubleImage'}}
49 <div class="items-s2"> 62 <div class="items-s2">
@@ -51,7 +64,9 @@ @@ -51,7 +64,9 @@
51 {{> reds-shop/item}} 64 {{> reds-shop/item}}
52 {{/each}} 65 {{/each}}
53 </div> 66 </div>
54 - {{> reds-shop/margin-bottom}} 67 + {{#if ../isModuleMargin}}
  68 + <div class="margin-bottom"></div>
  69 + {{/if}}
55 {{/isEqual}} 70 {{/isEqual}}
56 {{#isEqual module_type 'TripleImage'}} 71 {{#isEqual module_type 'TripleImage'}}
57 <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}}"> 72 <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}}">
@@ -59,10 +74,14 @@ @@ -59,10 +74,14 @@
59 {{> reds-shop/item}} 74 {{> reds-shop/item}}
60 {{/each}} 75 {{/each}}
61 </div> 76 </div>
62 - {{> reds-shop/margin-bottom}} 77 + {{#if ../isModuleMargin}}
  78 + <div class="margin-bottom"></div>
  79 + {{/if}}
63 {{/isEqual}} 80 {{/isEqual}}
64 {{#isEqual module_type 'SknList'}} 81 {{#isEqual module_type 'SknList'}}
65 <div class="index-goods-container" data-skns="{{../skns}}"></div> 82 <div class="index-goods-container" data-skns="{{../skns}}"></div>
66 - {{> reds-shop/margin-bottom}} 83 + {{#if ../isModuleMargin}}
  84 + <div class="margin-bottom"></div>
  85 + {{/if}}
67 {{/isEqual}} 86 {{/isEqual}}
68 {{/each}} 87 {{/each}}
@@ -2,7 +2,7 @@ const $ = require('yoho-jquery'); @@ -2,7 +2,7 @@ const $ = require('yoho-jquery');
2 const allProduct = require('./shop/all-product'); 2 const allProduct = require('./shop/all-product');
3 let Tab = require('../plugin/tab'); 3 let Tab = require('../plugin/tab');
4 4
5 -require('feature.css'); 5 +require('layout/_swiper.css');
6 require('product/search/list.page.css'); 6 require('product/search/list.page.css');
7 require('product/shop/redshop.page.css'); 7 require('product/shop/redshop.page.css');
8 8
@@ -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-28 10:12:24 5 + * @Last Modified time: 2017-03-28 17:14:11
6 */ 6 */
7 /* 红人店铺首页 */ 7 /* 红人店铺首页 */
8 const Swiper2 = require('yoho-swiper2'); 8 const Swiper2 = require('yoho-swiper2');
@@ -58,9 +58,9 @@ if ($('.shop-swiper')) { @@ -58,9 +58,9 @@ if ($('.shop-swiper')) {
58 lazyLoadingInPrevNext: true, 58 lazyLoadingInPrevNext: true,
59 loop: true, 59 loop: true,
60 autoplay: 3000, 60 autoplay: 3000,
61 - autoplayDisableOnInteraction: false,  
62 - paginationClickable: true,  
63 slideElement: 'li', 61 slideElement: 'li',
  62 + paginationClickable: true,
  63 + pagination: $(this).closest('.shop-swiper-' + i).find('.pagination-inner').get(0)
64 }); 64 });
65 } 65 }
66 } 66 }
@@ -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-28 10:38:11 5 + * @Last Modified time: 2017-03-28 17:08:45
6 */ 6 */
7 // 红人店铺首页 7 // 红人店铺首页
8 8
@@ -168,16 +168,12 @@ @@ -168,16 +168,12 @@
168 } 168 }
169 169
170 .shop-swiper { 170 .shop-swiper {
  171 + position: relative;
171 height: 234px; 172 height: 234px;
172 - overflow: hidden;  
173 173
174 ul { 174 ul {
175 width: 100%; 175 width: 100%;
176 } 176 }
177 -  
178 - ul > li {  
179 - width: 100%;  
180 - }  
181 } 177 }
182 178
183 .shop-video { 179 .shop-video {
@@ -221,4 +217,9 @@ @@ -221,4 +217,9 @@
221 height: 30px; 217 height: 30px;
222 background-color: #f0f0f0; 218 background-color: #f0f0f0;
223 } 219 }
  220 +
  221 + .margin-bottom {
  222 + width: 100%;
  223 + height: 40px;
  224 + }
224 } 225 }
@@ -2,14 +2,39 @@ @@ -2,14 +2,39 @@
2 * @Author: Targaryen 2 * @Author: Targaryen
3 * @Date: 2017-03-23 11:02:31 3 * @Date: 2017-03-23 11:02:31
4 * @Last Modified by: Targaryen 4 * @Last Modified by: Targaryen
5 - * @Last Modified time: 2017-03-28 14:50:20 5 + * @Last Modified time: 2017-03-28 17:57:48
6 */ 6 */
7 /* 红人店铺数据处理 */ 7 /* 红人店铺数据处理 */
8 8
9 const _ = require('lodash'); 9 const _ = require('lodash');
  10 +const helpers = global.yoho.helpers;
10 11
11 let countCarouselImage = 0; // 轮播图模块统计 12 let countCarouselImage = 0; // 轮播图模块统计
12 13
  14 +
  15 +/**
  16 + * 链接处理
  17 + * @param {*} linkParent
  18 + */
  19 +const _linkhandle = (linkParent) => {
  20 + if (linkParent.linkType) {
  21 + switch (parseInt(linkParent.linkType, 10)) {
  22 + case 0:
  23 + return helpers.urlFormat('', {
  24 + categoryId: linkParent.resource
  25 + }, 'list');
  26 + case 1:
  27 + return helpers.urlFormat('/product/' + linkParent.resource + '.html');
  28 + case 2:
  29 + return linkParent.resource;
  30 + default:
  31 + break;
  32 + }
  33 + } else {
  34 + return false;
  35 + }
  36 +};
  37 +
13 /** 38 /**
14 * 图片处理 39 * 图片处理
15 * @param {*} moduleData 40 * @param {*} moduleData
@@ -19,7 +44,9 @@ const _picsHandle = (moduleData) => { @@ -19,7 +44,9 @@ const _picsHandle = (moduleData) => {
19 44
20 _.forEach(_.get(moduleData, 'data', []), value => { 45 _.forEach(_.get(moduleData, 'data', []), value => {
21 pics.push({ 46 pics.push({
22 - src: value.pic 47 + src: value.pic,
  48 + link: _linkhandle(value),
  49 + text: value.text
23 }); 50 });
24 }); 51 });
25 return pics; 52 return pics;
@@ -38,7 +65,8 @@ const _tools = { @@ -38,7 +65,8 @@ const _tools = {
38 return { 65 return {
39 module_type: 'Title', 66 module_type: 'Title',
40 text: _.get(moduleData, 'data[0].text', ''), 67 text: _.get(moduleData, 'data[0].text', ''),
41 - isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false) 68 + isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
  69 + link: _linkhandle(_.get(moduleData, 'data[0]', 0))
42 }; 70 };
43 }, 71 },
44 72
@@ -52,6 +80,7 @@ const _tools = { @@ -52,6 +80,7 @@ const _tools = {
52 title: _.get(moduleData, 'data[0].text.title', ''), 80 title: _.get(moduleData, 'data[0].text.title', ''),
53 content: _.get(moduleData, 'data[0].text.content', ''), 81 content: _.get(moduleData, 'data[0].text.content', ''),
54 pic: _.get(moduleData, 'data[0].pic', ''), 82 pic: _.get(moduleData, 'data[0].pic', ''),
  83 + isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
55 }; 84 };
56 }, 85 },
57 86
@@ -60,11 +89,12 @@ const _tools = { @@ -60,11 +89,12 @@ const _tools = {
60 * @param {*} moduleData 89 * @param {*} moduleData
61 */ 90 */
62 carouselImage(moduleData) { 91 carouselImage(moduleData) {
  92 + console.log(moduleData);
63 return { 93 return {
64 module_type: 'CarouselImage', 94 module_type: 'CarouselImage',
65 num: countCarouselImage, 95 num: countCarouselImage,
66 pics: _picsHandle(moduleData), 96 pics: _picsHandle(moduleData),
67 - isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false), 97 + isModuleMargin: Boolean(_.get(moduleData, 'properties.isModuleMargin', 0)),
68 }; 98 };
69 }, 99 },
70 100
@@ -82,7 +112,7 @@ const _tools = { @@ -82,7 +112,7 @@ const _tools = {
82 width: _.get(moduleData, 'properties.width', ''), 112 width: _.get(moduleData, 'properties.width', ''),
83 height: _.get(moduleData, 'data[0].text', ''), 113 height: _.get(moduleData, 'data[0].text', ''),
84 moduleHeight: _.get(moduleData, 'properties.moduleHeight', ''), 114 moduleHeight: _.get(moduleData, 'properties.moduleHeight', ''),
85 - isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false), 115 + isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
86 }; 116 };
87 }, 117 },
88 118
@@ -94,7 +124,7 @@ const _tools = { @@ -94,7 +124,7 @@ const _tools = {
94 return { 124 return {
95 module_type: 'DoubleImage', 125 module_type: 'DoubleImage',
96 pics: _picsHandle(moduleData), 126 pics: _picsHandle(moduleData),
97 - isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false), 127 + isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
98 }; 128 };
99 }, 129 },
100 130
@@ -103,12 +133,12 @@ const _tools = { @@ -103,12 +133,12 @@ const _tools = {
103 * @param {*} moduleData 133 * @param {*} moduleData
104 */ 134 */
105 tripleImage(moduleData) { 135 tripleImage(moduleData) {
106 - let displayType = _.get(moduleData, 'properties.displayType', 1); 136 + let displayType = _.get(moduleData, 'properties.displayType', 0);
107 137
108 return { 138 return {
109 module_type: 'TripleImage', 139 module_type: 'TripleImage',
110 pics: _picsHandle(moduleData), 140 pics: _picsHandle(moduleData),
111 - isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false), 141 + isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
112 displayType: parseInt(displayType, 10), 142 displayType: parseInt(displayType, 10),
113 }; 143 };
114 }, 144 },