Authored by 王水玲

单品日

... ... @@ -12,6 +12,7 @@ const singleDay = (req, res) => {
module: 'activity',
page: 'single-day',
title: '超级单品日',
isApp: req.yoho.isApp,
pageHeader: headerModel.setNav({
navTitle: '超级单品日',
navBtn: false
... ...
... ... @@ -8,11 +8,13 @@ const utils = '../../../utils';
const logger = global.yoho.logger;
const serviceAPI = global.yoho.ServiceAPI;
const api = global.yoho.API;
const helpers = global.yoho.helpers;
const _ = require('lodash');
const resourcesProcess = require(`${utils}/resources-process`);
const getResourceData = () => {
return serviceAPI.get('operations/api/v5/resource/get', {
content_code: '345c80537dca15611f37ae4863004bfe'
content_code: 'c0acf0296a3c329678fb45da958d9951'
}, {
cache: true
}).then((result) => {
... ... @@ -33,7 +35,15 @@ const getProductData = (tabName) => {
cache: true
}).then((result) => {
if (result && result.code === 200) {
return result;
result.data = result.data || [];
_.forEach(result.data, (item) => {
item.url = helpers.urlFormat(`/product/pro_${item.productId}_${item.goodsId}/${item.cnAlphabet}.html`); // eslint-disable-line
item.url = helpers.appUrlFormat(item.url, 'go.productDetail', {
product_skn: item.productSkn
});
});
return result.data;
} else {
logger.error('get product data code no 200');
return [];
... ... @@ -50,7 +60,7 @@ const getTabData = () => {
cache: true
}).then((result) => {
if (result && result.code === 200) {
return result;
return result.data || [];
} else {
logger.error('get tab data code no 200');
return [];
... ...
... ... @@ -2,30 +2,5 @@
<div class="banner"></div>
<div class="swiper-tab"></div>
<div class="product-list">
<!--<ul>-->
<!--<li>-->
<!--<a href="">-->
<!--<img src=""/>-->
<!--<div class="product-info">-->
<!--<h3>AVIREX L-2 PATCH YING TIGERS男款上海别注夹克</h3>-->
<!--<p class="prompt-info">下单后25个工作日发货</p>-->
<!--<p class="price"><span class="sale-price">¥589</span><span class="market-price">¥1234</span></p>-->
<!--<p class="info-txt">#Yoho!Buy限定联名T恤#</p>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--<li>-->
<!--<a href="">-->
<!--<img src=""/>-->
<!--<div class="product-info">-->
<!--<h3>AVIREX L-2 PATCH YING TIGERS男款上海别注夹克</h3>-->
<!--<p class="prompt-info">下单后25个工作日发货</p>-->
<!--<p class="price"><span class="sale-price">¥589</span><span class="market-price">¥1234</span></p>-->
<!--<p class="info-txt">#Yoho!Buy限定联名T恤#</p>-->
<!--</div>-->
<!--</a>-->
<!--</li>-->
<!--</ul>-->
</div>
<div class="product-list"></div>
</div>
... ...
... ... @@ -16,15 +16,21 @@ module.exports = {
siteUrl: '//m.yohobuy.com',
assetUrl: '//localhost:5001',
domains: {
api: 'http://api.yoho.yohoops.org/',
service: 'http://service.yoho.yohoops.org/',
liveApi: 'http://api.live.yoho.cn/',
singleApi: 'http://single.yoho.cn/'
//api: 'http://api.yoho.yohoops.org/',
// service: 'http://service.yoho.yohoops.org/',
// liveApi: 'http://api.live.yoho.cn/',
// singleApi: 'http://single.yoho.cn/'
//api: 'http://api-test1.yohops.com:9999/',
service: 'http://service-test1.yohops.com:9999/',
//liveApi: 'http://testapi.live.yohops.com:9999/',
//singleApi: 'http://api-test1.yohops.com:9999/'
api: 'http://dev-api.yohops.com:9999/',
//service: 'http://dev-service.yohops.com:9999/',
liveApi: 'http://testapi.live.yohops.com:9999/',
singleApi: 'http://api-test1.yohops.com:9999/'
// api: 'http://api-test1.yohops.com:9999/',
// service: 'http://service-test1.yohops.com:9999/',
// liveApi: 'http://testapi.live.yohops.com:9999/',
// singleApi: 'http://api-test1.yohops.com:9999/',
},
subDomains: {
host: '.m.yohobuy.com',
... ...
... ... @@ -7,6 +7,7 @@ var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
lazyload = require('yoho-jquery-lazyload'),
banner = require('../../template/resources/banner-top.hbs'),
tab = require('../../template/activity/single-day/tab.hbs'),
product = require('../../template/activity/single-day/product-list.hbs');
... ... @@ -23,7 +24,7 @@ var getProductData = function(index, tabName) {
loading.showLoadingMask();
$.ajax({
type: 'GET',
url: '',
url: '/activity/single-day/getProductData',
data: {
tab_name: tabName
},
... ... @@ -32,6 +33,7 @@ var getProductData = function(index, tabName) {
$('.product-tab').eq(index).append(product(data));
}
lazyload($('img.lazy'));
getFlag = false;
loading.hideLoadingMask();
},
... ... @@ -52,9 +54,9 @@ var getInitData = function() {
type: 'GET',
url: '/activity/single-day/getSingleData',
success: function(data) {
var i = 0;
var i = 0, $swiperTab;
data[1] = ['限定名额', '首发', '热卖', '明星单品'];
//data[1] = ['限定名额', '首发', '热卖', '明星单品'];
if (data[0]) {
$('.banner').append(banner(data[0][0]));
... ... @@ -75,6 +77,8 @@ var getInitData = function() {
if (data[1]) {
$('.swiper-tab').append(tab(data[1]));
$swiperTab = $('.swiper-tab li');
new Swiper('.swiper-tab', {
slidesPerView: 'auto'
});
... ... @@ -84,19 +88,19 @@ var getInitData = function() {
}
getProductData(hash, tabName(hash));
$swiperTab.eq(hash).addClass('active');
$('.swiper-tab li')
.eq(hash)
.addClass('active')
.on('click', function() {
var index = $(this).index();
if ($('.product-tab').eq(index).find('li').length > 0) {
return false;
} else {
getProductData(index, tabName(index));
}
});
$swiperTab.on('click', function() {
var index = $(this).index();
$swiperTab.removeClass('active').eq(index).addClass('active');
if ($('.product-tab').eq(index).find('li').length > 0) {
return false;
} else {
getProductData(index, tabName(index));
}
});
}
loading.hideLoadingMask();
... ...
... ... @@ -3,6 +3,11 @@
.banner {
width: 100%;
height: 200px;
.swiper-slide {
height: 200px;
}
}
.swiper-tab {
... ... @@ -22,6 +27,7 @@
line-height: 30px;
color: #b0b0b0;
width: auto;
font-size: 26px;
}
li:last-child {
... ... @@ -47,7 +53,7 @@
height: auto;
overflow: hidden;
img {
.lazy {
width: 274px;
height: 368px;
float: left;
... ... @@ -61,21 +67,28 @@
float: left;
position: relative;
border-bottom: 1px solid #e8e8e8;
padding-right: 15px;
box-sizing: border-box;
}
h3 {
margin-top: 43px;
font-size: 24px;
font-size: 28px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
color: #444;
}
.prompt-info {
font-size: 20px;
font-size: 24px;
margin-top: 28px;
color: #d11226;
width: 100%;
overflow: hidden;
white-space: nowrap;
text-overflow: ellipsis;
}
.price {
... ... @@ -83,8 +96,8 @@
}
.sale-price {
font-size: 20px;
color: #d11226;
font-size: 24px;
color: #cf031e;
}
.no-price {
... ... @@ -92,8 +105,8 @@
}
.market-price {
font-size: 20px;
color: #a1a1a1;
font-size: 24px;
color: #b0b0b0;
text-decoration: line-through;
margin-left: 14px;
}
... ... @@ -101,11 +114,12 @@
.info-txt {
position: absolute;
top: 298px;
font-size: 20px;
font-size: 24px;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
color: #454545;
}
}
}
... ...
{{#each data}}
{{#each this}}
<li >
<a href="{{url}}">
<img src="{{image productLink 274 368}}"/>
<img class="lazy" data-original="{{image productLink 274 368}}"/>
<div class="product-info">
<h3>{{productTitle}}</h3>
{{#intro}}<p class="prompt-info">{{intro}}</p>{{/intro}}
<p class="price"><span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salePrice}}</span><span class="market-price">¥{{marketPrice}}</span></p>
{{#salesPhrase}}
<p class="prompt-info">{{.}}</p>
{{/salesPhrase}}
<p class="price">
<span class="sale-price {{^marketPrice}}no-price{{/marketPrice}}">¥{{salesPrice}}</span>
{{#marketPrice}}
<span class="market-price">¥{{.}}</span>
{{/marketPrice}}
</p>
<p class="info-txt">{{productDesc}}</p>
</div>
</a>
... ...