Authored by 郭成尧

img-link

<div class="item">
<img class="item-pic" src="{{src}}" alt="">
{{#if link}}
<a href="{{link}}">
<img class="item-pic" src="{{src}}" alt="">
</a>
{{^}}
<img class="item-pic" src="{{src}}" alt="">
{{/if}}
<div class="item-info">
<div class="">ABCDEFG ABCDEFG</div>
<div>
... ...
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
\ No newline at end of file
... ... @@ -2,24 +2,33 @@
{{#isEqual module_type 'Title'}}
<header class="section-header">
<div class="section-title">{{../text}}</div>
<a class="section-more" href=""><i class="iconfont">&#xe606;</i></a>
{{#if ../link}}
<a class="section-more" href="{{../link}}"><i class="iconfont">&#xe606;</i></a>
{{/if}}
</header>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/isEqual}}
{{#isEqual module_type 'CarouselImage'}}
<div class="shop-swiper shop-swiper-{{../num}}">
<ul class="swiper-wrapper">
{{#each ../pics}}
<li class="swiper-slide">
<a href="{{url}}">
{{#if link}}
<a href="{{link}}">
<img src="{{src}}" alt="">
</a>
{{^}}
<img src="{{src}}" alt="">
</a>
{{/if}}
</li>
{{/each}}
</ul>
<div class="swiper-pagination"></div>
</div>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/isEqual}}
{{#isEqual module_type 'Video'}}
<div class="shop-video shop-section">
... ... @@ -35,7 +44,9 @@
<p class="text-line-2">{{../content}}</p>
</div>
</div>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/isEqual}}
{{#isEqual module_type 'SingleImage'}}
<div class="items-s1">
... ... @@ -43,7 +54,9 @@
{{> reds-shop/item}}
{{/each}}
</div>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/isEqual}}
{{#isEqual module_type 'DoubleImage'}}
<div class="items-s2">
... ... @@ -51,7 +64,9 @@
{{> reds-shop/item}}
{{/each}}
</div>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/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}}">
... ... @@ -59,10 +74,14 @@
{{> reds-shop/item}}
{{/each}}
</div>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/isEqual}}
{{#isEqual module_type 'SknList'}}
<div class="index-goods-container" data-skns="{{../skns}}"></div>
{{> reds-shop/margin-bottom}}
{{#if ../isModuleMargin}}
<div class="margin-bottom"></div>
{{/if}}
{{/isEqual}}
{{/each}}
... ...
... ... @@ -2,7 +2,7 @@ const $ = require('yoho-jquery');
const allProduct = require('./shop/all-product');
let Tab = require('../plugin/tab');
require('feature.css');
require('layout/_swiper.css');
require('product/search/list.page.css');
require('product/shop/redshop.page.css');
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-23 11:31:51
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-28 10:12:24
* @Last Modified time: 2017-03-28 17:14:11
*/
/* 红人店铺首页 */
const Swiper2 = require('yoho-swiper2');
... ... @@ -58,9 +58,9 @@ if ($('.shop-swiper')) {
lazyLoadingInPrevNext: true,
loop: true,
autoplay: 3000,
autoplayDisableOnInteraction: false,
paginationClickable: true,
slideElement: 'li',
paginationClickable: true,
pagination: $(this).closest('.shop-swiper-' + i).find('.pagination-inner').get(0)
});
}
}
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2017-03-23 17:12:53
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-28 10:38:11
* @Last Modified time: 2017-03-28 17:08:45
*/
// 红人店铺首页
... ... @@ -168,16 +168,12 @@
}
.shop-swiper {
position: relative;
height: 234px;
overflow: hidden;
ul {
width: 100%;
}
ul > li {
width: 100%;
}
}
.shop-video {
... ... @@ -221,4 +217,9 @@
height: 30px;
background-color: #f0f0f0;
}
.margin-bottom {
width: 100%;
height: 40px;
}
}
... ...
... ... @@ -2,14 +2,39 @@
* @Author: Targaryen
* @Date: 2017-03-23 11:02:31
* @Last Modified by: Targaryen
* @Last Modified time: 2017-03-28 14:50:20
* @Last Modified time: 2017-03-28 17:57:48
*/
/* 红人店铺数据处理 */
const _ = require('lodash');
const helpers = global.yoho.helpers;
let countCarouselImage = 0; // 轮播图模块统计
/**
* 链接处理
* @param {*} linkParent
*/
const _linkhandle = (linkParent) => {
if (linkParent.linkType) {
switch (parseInt(linkParent.linkType, 10)) {
case 0:
return helpers.urlFormat('', {
categoryId: linkParent.resource
}, 'list');
case 1:
return helpers.urlFormat('/product/' + linkParent.resource + '.html');
case 2:
return linkParent.resource;
default:
break;
}
} else {
return false;
}
};
/**
* 图片处理
* @param {*} moduleData
... ... @@ -19,7 +44,9 @@ const _picsHandle = (moduleData) => {
_.forEach(_.get(moduleData, 'data', []), value => {
pics.push({
src: value.pic
src: value.pic,
link: _linkhandle(value),
text: value.text
});
});
return pics;
... ... @@ -38,7 +65,8 @@ const _tools = {
return {
module_type: 'Title',
text: _.get(moduleData, 'data[0].text', ''),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false)
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
link: _linkhandle(_.get(moduleData, 'data[0]', 0))
};
},
... ... @@ -52,6 +80,7 @@ const _tools = {
title: _.get(moduleData, 'data[0].text.title', ''),
content: _.get(moduleData, 'data[0].text.content', ''),
pic: _.get(moduleData, 'data[0].pic', ''),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
};
},
... ... @@ -60,11 +89,12 @@ const _tools = {
* @param {*} moduleData
*/
carouselImage(moduleData) {
console.log(moduleData);
return {
module_type: 'CarouselImage',
num: countCarouselImage,
pics: _picsHandle(moduleData),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false),
isModuleMargin: Boolean(_.get(moduleData, 'properties.isModuleMargin', 0)),
};
},
... ... @@ -82,7 +112,7 @@ const _tools = {
width: _.get(moduleData, 'properties.width', ''),
height: _.get(moduleData, 'data[0].text', ''),
moduleHeight: _.get(moduleData, 'properties.moduleHeight', ''),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
};
},
... ... @@ -94,7 +124,7 @@ const _tools = {
return {
module_type: 'DoubleImage',
pics: _picsHandle(moduleData),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
};
},
... ... @@ -103,12 +133,12 @@ const _tools = {
* @param {*} moduleData
*/
tripleImage(moduleData) {
let displayType = _.get(moduleData, 'properties.displayType', 1);
let displayType = _.get(moduleData, 'properties.displayType', 0);
return {
module_type: 'TripleImage',
pics: _picsHandle(moduleData),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', false),
isModuleMargin: _.get(moduleData, 'properties.isModuleMargin', 0),
displayType: parseInt(displayType, 10),
};
},
... ...