Authored by 郭成尧

handpick-add

... ... @@ -72,7 +72,32 @@ const _newGoods = (req, res, next) => {
let banner = _.get(result, 'ads[0]', {});
let handPick = _.get(result, 'ads[1]', {});
// console.log(handPick)
console.log(handPick);
// handPick.data = [
// // {
// // src: 'http://img10.static.yhbimg.com/yhb-img01/2017/01/09/13/01da40539b33823497bde77bcfdb6d94b5.jpg?imageView2/{mode}/w/{width}/h/{height}',
// // alt: '',
// // title: '',
// // url: 'https://m.yohobuy.com/product/new'
// // },
// {
// src: 'http://img10.static.yhbimg.com/yhb-img01/2017/01/13/14/012d3366259d5afe4c4d4bf6d5a23278f7.jpg?imageView2/{mode}/w/{width}/h/{height}',
// alt: '',
// title: '',
// url: 'http://www.yohobuy.com'
// }
// ];
if (handPick.data) {
if (handPick.data.length > 2) {
handPick.three = true;
} else if (handPick.data.length === 2) {
handPick.two = true;
} else if (handPick.data.length === 1) {
handPick.one = true;
}
}
res.render('new/index', {
module: 'product',
... ...
... ... @@ -38,8 +38,14 @@
{{/if}}
{{!--精选抢先看--}}
{{#if handPick.data}}
{{> 'new/handpick' swiper=handPick.data}}
{{#if handPick.three}}
{{> 'new/handpick-three' swiper=handPick.data}}
{{/if}}
{{#if handPick.two}}
{{> 'new/handpick-two' swiper=handPick.data}}
{{/if}}
{{#if handPick.one}}
{{> 'new/handpick-one' swiper=handPick.data}}
{{/if}}
{{!--最新上架--}}
... ...
... ... @@ -8,17 +8,17 @@
</header>
<main class="panel-body">
<!-- Slider main container -->
<div class="handpick-swiper swiper-container">
<div class="handpick-swiper-one swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{{#each swiper}}
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image2 src w=332 h=194 q=60}}" alt="">
<img src="{{image2 src w=690 h=220 q=60}}" alt="">
</a>
</div>
{{/each}}
{{/swiper}}
</div>
</div>
</main>
... ...
{{!-- 新品到着: 精选 --}}
<div id="handpick" class="panel handpick">
<header class="panel-header">
<h4>精选抢先看</h4>
{{!--<a href="#javascript" class="panel-header-r more">
<i class="iconfont">&#xe606;</i>
</a>--}}
</header>
<main class="panel-body">
<!-- Slider main container -->
<div class="handpick-swiper-three swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img class="swiper-lazy" data-src="{{image2 src w=330 h=220 q=60}}" alt="">
</a>
</div>
{{/swiper}}
</div>
</div>
</main>
</div>
\ No newline at end of file
... ...
{{!-- 新品到着: 精选 --}}
<div id="handpick" class="panel handpick">
<header class="panel-header">
<h4>精选抢先看</h4>
{{!--<a href="#javascript" class="panel-header-r more">
<i class="iconfont">&#xe606;</i>
</a>--}}
</header>
<main class="panel-body">
<!-- Slider main container -->
<div class="handpick-swiper-two swiper-container">
<!-- Additional required wrapper -->
<div class="swiper-wrapper">
<!-- Slides -->
{{# swiper}}
<div class="swiper-slide">
<a href="{{url}}">
<img src="{{image2 src w=330 h=220 q=60}}" alt="">
</a>
</div>
{{/swiper}}
</div>
</div>
</main>
</div>
\ No newline at end of file
... ...
... ... @@ -17,21 +17,21 @@ module.exports = {
assetUrl: '//127.0.0.1:5001',
testCode: 'yoho4946abcdef#$%&!@',
domains: {
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test3.yohops.com:9999/',
// imSocket: 'ws://im.yohobuy.com:10240',
// imCs: 'http://im.yohobuy.com/api',
// imServer: 'http://im.yohobuy.com/server'
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test3.yohops.com:9999/',
imSocket: 'ws://im.yohobuy.com:10240',
imCs: 'http://im.yohobuy.com/api',
imServer: 'http://im.yohobuy.com/server'
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/',
imSocket: 'wss://imsocket.yohobuy.com:443',
imCs: 'https://imhttp.yohobuy.com/api',
imServer: 'https://imhttp.yohobuy.com/server'
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/',
// imSocket: 'wss://imsocket.yohobuy.com:443',
// imCs: 'https://imhttp.yohobuy.com/api',
// imServer: 'https://imhttp.yohobuy.com/server'
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -14,7 +14,7 @@ let $callback = $.Callbacks(); // eslint-disable-line
// 是否继续加载数据
let isScroll = true;
new Swiper('.handpick-swiper', {
new Swiper('.handpick-swiper-three', {
// Optional parameters
lazyLoading: true,
lazyLoadingInPrevNext: true,
... ...
/* 精选抢先看 */
.handpick {
.panel-body {
padding-top: 30px;
padding-bottom: 30px;
}
.swiper-wrapper {
align-items: center;
}
.swiper-container {
height: 220px;
height: 185px;
}
.swiper-slide {
width: 300px;
height: 173px;
height: 185px;
background-color: #444;
border-radius: 6px;
overflow: hidden;
}
}
.handpick-swiper-two {
.swiper-slide {
margin-left: 30px;
width: 277px;
}
}
.handpick-swiper-one {
.swiper-slide {
width: 580px;
margin-left: 30px;
}
}
\ No newline at end of file
... ...