Authored by 514335620@qq.com

首页模板

... ... @@ -29,40 +29,244 @@ const handleSaleData = (origin) => {
*/
exports.outputDevData = () => {
return {
slide: {
list: [{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}, {
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}, {
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}]
module: 'product',
page: 'sale',
topBanner: {
list: [
{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
},
{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
},
{
bannerHeight: 200,
href: 'http://www.yoho.cn',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/830/h/327'
}
]
},
recommandImg: [{
jumpUrl: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/250/h/80',
sourceUrl: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/250/h/80'
}, {
jumpUrl: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/250/h/80',
sourceUrl: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/250/h/80'
}, {
jumpUrl: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/250/h/80',
sourceUrl: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/250/h/80'
}],
activityEnter: [
{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
},
{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
},
{
link: 'www.baidu.com',
icon: 'dasdasdas',
title: '我是标题',
desc: '参加活动'
}
],
brandSale: [
{
big: [
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '低于一小时',
brand: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/80/h/50',
discount: '1折起'
}
],
normal: [
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
},
{
link: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
time: '剩余22小时',
title: 'yoho!buy 新品大促销,全场100折'
}
]
specialSale: {
brandSale: {
big: [{
}
],
}]
saleCategory: [
{
title: 'VIP会员专享',
navItem: [
{
vip: true,
url: '/sa/ds',
title: '今日推荐'
},
{
incompleteSize: true,
url: '/sa/ds',
title: '上装'
},
{
newDiscount: true,
url: '/sa/ds',
title: '裤装'
},
{
vip: true,
url: '/sa/ds',
title: '鞋履'
},
{
vip: true,
url: '/sa/ds',
title: '配饰'
}
],
saleImage: [
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
},
{
href: 'www.baidu.com',
img: 'http://img10.static.yhbimg.com/yhb-img01/2016/05/13/19/0144078a008a5dc2be52a6ec65c74c1f2c.jpg?imageView2/1/w/378/h/500',
name: '测试商品',
originPrice: '11321',
price: '213',
vip: true
}
]
},
{
title: '断码区',
navItem: [
{
vip: true,
url: '/sa/ds',
title: '今日推荐'
},
{
incompleteSize: true,
url: '/sa/ds',
title: '上装'
},
{
newDiscount: true,
url: '/sa/ds',
title: '裤装'
},
{
vip: true,
url: '/sa/ds',
title: '鞋履'
},
{
vip: true,
url: '/sa/ds',
title: '配饰'
}
]
}
}
]
};
};
... ...
<div class="sale-page yoho-page">
<div class="sale-page yoho-page center-content">
{{! 头部banner}}
{{log this}}
{{# slide}}
{{#topBanner}}
{{> common/slide-banner}}
{{/ slide}}
{{/topBanner}}
{{! banner底部图片}}
{{#each recommandImg}}
<img href="{{jumpUrl}}" src="{{sourceUrl}}">
</img>
{{/each}}
{{! 折扣专场}}
{{# specialSale}}
{{> sale/brand-sale}}
{{/ specialSale}}
{{! 类别楼层遍历}}
{{# category}}
{{> sale/sale-box}}
{{/ category}}
{{> sale/activity-entry}}
{{> sale/brand-sale}}
{{> sale/sale-box}}
<p>coding here index</p>
</div>
... ...
<div class="home-page">
{{#sale-category}}
{{#saleCategory}}
<div class="floor-header clearfix">
<h2 class="floor-title">{{title}}</h2>
</div>
<ul class="sale-nav">
{{#navItem}}
<li class="{{#vip}}green{{/vip}} {{#incompleteSize}}yellow{{/incompleteSize}} {{#newDiscount}}red{{/newDiscount}} {{#if @first}}active first{{/if}} {{#if @last}}last{{/if}}" data-url='{{url}}'>aa</li>
<li class="{{#vip}}green{{/vip}} {{#incompleteSize}}yellow{{/incompleteSize}} {{#newDiscount}}red{{/newDiscount}} {{#if @first}}active first{{/if}} {{#if @last}}last{{/if}}" data-url='{{url}}'>{{title}}</li>
{{/navItem}}
</ul>
<div class="commodity-list">
... ... @@ -27,5 +27,5 @@
{{/each}}
</ul>
</div>
{{/sale-category}}
{{/saleCategory}}
</div>
... ...
var $ = require('yoho-jquery'),
$navItem = $('.sale-nav li'),
lazyLoad = require('yoho-jquery-lazyload');
require('../header');
require('../index/slider');
lazyLoad($('img.lazy'));
$('.slide-container').slider();
$navItem.on('click', function() {
$(this).siblings('.active').removeClass('active');
$(this).addClass('active');
});
$('#slider').slider();
... ...
.yoho-page {
.floor-header {
position: relative;
margin: 80px 0 40px;
... ...
... ... @@ -231,6 +231,4 @@ a {
@import "common/index";
/* 模块 */
/* product */
@import "product/index";
... ...
.center-content {
width: 1150px;
margin-left: auto;
margin-right: auto;
}
.sale-page {
.sale-list-banner {
width: 100%;
margin-top: 10px;
.slide-switch {
display: block;
a {
position: absolute;
top: 50%;
margin: -30px 0 0;
width: 60px;
height: 60px;
line-height: 56px;
text-align: center;
z-index: 2;
background: #fff;
opacity: 0.55;
&.prev {
left: 50%;
margin-left: -575px;
}
&.next {
right: 50%;
margin-right: -575px;
}
&:hover {
opacity: 0.9;
}
.iconfont {
font-size: 32px;
color: #59585a;
}
}
}
.slide-container {
position: relative;
height: 450px;
overflow: hidden;
}
ul {
overflow: hidden;
width: 100%;
position: relative;
z-index: 1;
.activity-entry {
margin: 10px 0;
li {
width: 100%;
height: 100%;
display: block;
.entry-item {
display: block;
width: 377px;
margin-right: 10px;
padding: 24px 0;
background: #f5f5f5;
&.first,
&.last {
width: 376px;
}
&.last {
margin-right: 0;
}
}
.entry-text {
padding-left: 160px;
font-size: 16px;
}
.icon {
width: 70px;
height: 70px;
margin-left: 48px;
background-repeat: no-repeat;
&.vip {
background-image: resolve('sale/for-vip.png');
}
&.discount {
background-image: resolve('sale/discount.png');
}
&.off-price {
background-image: resolve('sale/off-price.png');
}
}
.title {
font-size: 26px;
font-weight: bold;
line-height: 48px;
}
}
.floor-title {
margin: 80px auto 40px;
width: 300px;
font-size: 16px;
line-height: 30px;
text-align: center;
border: 1px solid #000;
}
.brand-sale {
.sale-group-big {
width: 1150px + 10px;
.item {
width: 375px;
margin-right: 8px;
margin-bottom: 10px;
}
.pic {
position: relative;
height: 400px;
}
.time {
@include box-sizing(border-box);
position: absolute;
top: 0;
left: 0;
bottom: 0;
width: 100%;
font-size: 22px;
line-height: 30px;
text-align: right;
color: #fff;
background: #4e4e4e;
}
.detail {
background: #f5f5f5;
}
.brand {
margin: 24px 10px 0;
}
.text {
padding: 24px 10px 24px 0;
font-size: 14px;
color: #fd5659;
}
.discount {
font-size: 28px;
font-weight: bold;
.num {
font-size: 40px;
}
}
}
.sale-group {
width: 1150px + 8px;
.item {
width: 183px;
margin-right: 8px;
margin-bottom: 10px;
}
.pic {
width: 100%;
display: block;
}
.detail {
padding: 14px 10px;
background: #f5f5f5;
text-align: center;
line-height: 20px;
}
.title {
font-size: 12px;
}
.time {
font-size: 14px;
}
}
}
.sale-nav li {
float: left;
width: 20%;
height: 40px;
line-height: 40px;
background-color: #e0e0e0;
text-align: center;
background-color: #f5f5f5;
color: #6d6d6d;
margin-bottom: 10px;
&.active {
color: #fff;
background-repeat: no-repeat;
background-size: 100% 100%;
}
&.green {
&.active {
color: #fff;
background-image: resolve("sale/navactive-green-middle.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
&.first.active {
background-image: resolve("sale/navactive-green-first.png");
}
&.last.active {
background-image: resolve("sale/navactive-green-last.png");
}
}
&.yellow {
&.active {
color: #fff;
background-image: resolve("sale/navactive-yellow-middle.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
&.first.active {
background-image: resolve("sale/navactive-yellow-first.png");
}
&.last.active {
background-image: resolve("sale/navactive-yellow-last.png");
}
}
&.red {
&.active {
color: #fff;
background-image: resolve("sale/navactive-red-middle.png");
background-repeat: no-repeat;
background-size: 100% 100%;
}
&.first.active {
background-image: resolve("sale/navactive-red-first.png");
}
&.last.active {
background-image: resolve("sale/navactive-red-last.png");
}
}
}
@media screen and (min-width: 1150px) {
.floor-header {
margin: 80px 0 40px;
.header-navs li {
padding: 1px 15px;
}
}
}
.commodity-list ul {
width: 1004px;
}
.commodity-item {
float: left;
width: 241px;
margin: 0 10px 0 0;
}
.commodity-img {
position: relative;
height: 323px;
text-align: center;
img {
width: 100%;
height: 100%;
vertical-align: middle;
}
.top-tag {
position: absolute;
width: 60px;
height: 60px;
top: 10px;
right: 10px;
line-height: 60px;
background: url('../assets/images/furniture/top-tag-bg.png?1450667948');
font-size: 20px;
color: #fff;
}
.few-tag {
position: absolute;
bottom: 0;
width: 100%;
height: 20px;
background: #ffac5b;
color: #fff;
line-height: 20px;
text-align: center;
font-size: 12px;
}
}
.commodity-content {
padding-top: 10px;
height: 69px;
overflow: hidden;
.commodity-name {
font-size: 12px;
color: #000;
line-height: 18px;
text-align: center;
}
.commodity-price {
position: relative;
margin-top: 3px;
text-align: center;
line-height: 20px;
color: #000;
span {
display: inline-block;
*display: inline;
*zoom: 1;
font-size: 12px;
padding: 0 15px;
&.origin {
text-decoration: line-through;
}
}
strong {
font-weight: normal;
color: #565656;
font-size: 13px;
}
span.vip-tag {
background-image: resolve("sale/vip.png");
background-repeat: no-repeat;
background-size: 100% 90%;
color: #fff;
font-style: italic;
margin-right: 5px;
}
.price-sale {
margin-left: 10px;
padding-left: 10px;
width: 36px;
height: 20px;
line-height: 20px;
background: url('../assets/images/furniture/sale-tag-bg.png?1450667948');
color: #fff;
}
}
}
@media screen and (min-width: 1150px) {
.commodity-list ul {
width: 1160px;
}
.commodity-item {
width: 280px;
}
.commodity-img {
height: 374px;
}
.commodity-content {
padding-top: 14px;
height: 77px;
}
}
}
.sale-list-page {
.sale-title {
margin: 30px 0;
font-size: 12px;
line-height: 26px;
.title {
margin-right: 20px;
font-size: 16px;
}
.discount {
display: inline-block;
margin-right: 10px;
padding: 0 10px;
font-weight: lighter;
line-height: 16px;
vertical-align: text-bottom;
color: #fff;
background: #ff575c;
}
.time {
.iconfont {
margin-right: 5px;
}
}
}
.sort {
padding: 10px;
border: 1px solid #eaeceb;
li {
display: inline-block;
margin-right: 15px;
padding: 0 10px;
font-size: 12px;
line-height: 20px;
color: #444;
&.title {
margin-right: 0;
font-weight: bold;
}
&.active {
color: #666;
border: 1px solid #000;
}
}
}
}
... ...