Authored by 王水玲

Merge branch 'release/4.6' of git.yoho.cn:fe/yohobuywap-node into release/4.6

... ... @@ -12,12 +12,12 @@ const renderData = {
module: 'product'
};
const yhChannelMap = {
boys: 1,
girls: 2,
kids: 3,
lifestyle: 4
};
// const yhChannelMap = {
// boys: 1,
// girls: 2,
// kids: 3,
// lifestyle: 4
// };
// 奥莱首页控制器
exports.index = (req, res) => {
... ... @@ -64,9 +64,12 @@ exports.activityList = (req, res) => {
let type = req.query.type || 2;
let template = type === 2 ? 'outlet/will-end' : 'outlet/will-start';
let page = type === 2 ? 'outlet-will-end' : 'outlet-will-start';
let yhChannel = req.query.yh_channel || yhChannelMap[req.yoho.channel];
outletModel.getNearlyActivity(yhChannel, type, categoryId).then(result => {
if (!categoryId) {
throw new Error('No parent_id for OUTLET channel page!');
}
outletModel.getRecentActivity(type, categoryId).then(result => {
res.render(template, Object.assign({
page: page,
pageHeader: headerData,
... ...
... ... @@ -33,7 +33,7 @@ const getOutletResource = (channel, contentcode) => {
return resourcesProcess(result.data.list);
} else {
log.error('奥莱资源位接口返回状态码 不是 200');
return result;
return [];
}
});
};
... ... @@ -68,7 +68,7 @@ const getNavData = (categoryId) => {
return data;
} else {
log.error('奥莱导航接口返回状态码 不是 200', result);
return result;
return [];
}
});
};
... ... @@ -115,7 +115,7 @@ const convertActicityData = (data) => {
const getHomeActivity = (data) => {
var params = {
method: 'app.outlets.activityGet',
platform: 2,
platform: 3
};
return api.get('', sign.apiSign(_.assign(params, data))).then(res => {
... ... @@ -124,48 +124,51 @@ const getHomeActivity = (data) => {
};
exports.getContent = (categoryId, channel, code) => {
let floorsData = {},
params = {
type: 0,
yh_channel: channel
};
let params = {
type: 0,
yh_channel: channel
};
const p = [getNavData(categoryId), getOutletResource(channel, code), getHomeActivity(params)];
return Promise.all(p).then(data => {
floorsData.nav = data[0] || [];
floorsData.content = data[1] || [];
floorsData.activity = {data: data[2]};
return floorsData;
return {
nav: data[0] || [],
content: data[1] || [],
activity: data[2]
};
});
};
exports.getActivity = (id) => {
return getActivityDetail(id).then(res => {
var data = {};
data.outletActivity = res;
data.productPool = res[0] && res[0].productPoolId || '';
data.saleType = 4;
return data;
return {
outletActivity: res,
productPool: res[0] || res[0].productPoolId || '',
saleType: 4
};
});
};
exports.getNearlyActivity = (channel, type, categoryId) => {
/**
* 获取即将开始或即将结束的活动列表
* @param {Number} type 标明是即将开始还是即将技术
* @param {String} categoryId 父级菜单id,用于标明当前页面是奥莱页面
* @return {Object} 活动列表数据
*/
exports.getRecentActivity = (type, categoryId) => {
var params = {
type: type
};
return Promise.all([getNavData(categoryId), getHomeActivity(params)]).then(res => {
var data = {
return {
nav: res[0] || [],
activity: {
data: res[1]
}
activity: res[1]
};
return data;
});
};
... ...
<div class="outlet-page yoho-page">
{{> product/outlet/nav}}
{{# activity}}
{{#data}}
<a class="will-end-back" href="{{activityUrl}}" >
<img class="back-image" src="{{image coverUrl 640 300}}">
<div class="last-time"><i class="iconfont time-ico">&#xe603;</i><span>{{>product/outlet/countdown}}</span></div>
<div class="line-space">
<span class="num">{{promotionName}} </span>
<span class="title">{{title}}</span>
<img class="logo" src="{{image logoUrl 150 100}}"></img>
</div>
</a>
{{/data}}
<a class="will-end-back" href="{{activityUrl}}" >
<img class="back-image" src="{{image coverUrl 640 300}}">
<div class="last-time"><i class="iconfont time-ico">&#xe603;</i><span>{{>product/outlet/countdown}}</span></div>
<div class="line-space">
<span class="num">{{promotionName}} </span>
<span class="title">{{title}}</span>
<img class="logo" src="{{image logoUrl 150 100}}"></img>
</div>
</a>
{{/ activity}}
</div>
... ...
<div id="demo1">
<!--<p>1 默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒</p>-->
<div class="cd cd-lite time" data-config="{'leftTime':{{leftTime}} }">— 仅剩<span class="left-day">${d}天</span>${h}时${m}分${s}秒 —</div>
<!--<div class="cd cd-medium" data-config="{'leftTime':82390943}">剩余时间:${h}时${m}分${s}秒</div>-->
<!--默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒-->
<div class="cd cd-lite time hide" data-config="{'leftTime': {{leftTime}} }">— 仅剩<span class="left-day">${d}天</span>${h}时${m}分${s}秒 —</div>
<div class="cd cd-medium time hide" data-config="{'leftTime': {{leftTime}} }">仅剩<span class="left-day">${d}天</span>${h}时${m}分${s}秒</div>
</div>
<!--<div id="demo4">-->
<!--<p>2 notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s</p>-->
<!--&lt;!&ndash;notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s&ndash;&gt;-->
<!--<div class="cd cd-large cd-slide" data-config="{'leftTime':4}">剩余时间:<span class="clock">${h}时${m}分${s}秒</span></div>-->
<!--</div>-->
<!--<div id="demo6">-->
<!--<p>3 使用本地时间(注意:stopPoint为UNIX时间戳,故单位是毫秒) & 使用js配置,不依赖DOM上的data-config</p>-->
<!--&lt;!&ndash;使用本地时间(注意:stopPoint为UNIX时间戳,故单位是毫秒) & 使用js配置,不依赖DOM上的data-config&ndash;&gt;-->
<!--<div class="cd cd-large cd-slide" data-config="{'stopPoint':4529059200000,'effect':'slide'}">剩余时间:<span class="clock">${d}天${h}时${m}分${s}秒</span></div>-->
<!--</div>-->
... ...
<div class="active-list">
{{#data}}
<a class="back-ground-white {{#if hide}} hidden {{/if}}" href="{{activityUrl}}" >
<img class="back-image" src="{{image coverUrl 640 300}}">
<div class="center-square">
<img class="logo" src="{{image logoUrl 150 100}}"></img>
<img class="logo" src="{{image logoUrl 85 55}}"></img>
<div class="title">{{title}}</div>
<div class="num">{{promotionName}} </div>
{{>product/outlet/countdown}}
</div>
</a>
{{/data}}
</div>
<div class="more-activity hide"><p>更多精彩活动</p><span class="iconfont count-down-icon">&#xe609;</span></div>
... ...
... ... @@ -5,13 +5,17 @@ var $ = require('yoho-jquery'),
Countdown = require('./outlet/countdown'),
tip = require('../plugin/tip');
var el = $('.cd-lite');
var $el = $('.cd-medium');
require('../common');
new Countdown.Countdown({
el: el
});
if ($el.length > 0) {
$el.each(function(){
Countdown.Countdown({
el: $(this)
})
})
}
$('.will-end-back').on('click', function() {
tip.show('活动即将结束');
... ...
... ... @@ -5,13 +5,17 @@ var $ = require('yoho-jquery'),
Countdown = require('./outlet/countdown'),
tip = require('../plugin/tip');
var el = $('.cd-lite');
var $el = $('.cd-lite');
require('../common');
new Countdown.Countdown({
el: el
});
if ($el.length > 0) {
$el.each(function(){
Countdown.Countdown({
el: $(this)
})
})
}
$('.back-ground-white').on('click', function() {
tip.show('活动即将开始');
... ...
... ... @@ -15,9 +15,11 @@ lazyLoad($('img.lazy'));
if ($el.length > 0) {
new Countdown.Countdown({
el: $el
});
$el.each(function(){
Countdown.Countdown({
el: $(this)
})
})
}
if ($('.swiper-container .swiper-slide').length > 1) {
... ... @@ -69,15 +71,16 @@ if ($('#index_nav').length > 0) {
}).goto($('#index_nav').find('.active').index());
}
if ($('.outlet-category-nav').length > 0) {
if ($('#list-nav').length > 0) {
iscroll({
el: '.outlet-category-nav'
el: '#list-nav'
}).goto(0);
}
if ($('.back-ground-white').length > 10) {
$('.more-activity').show();
$('.back-ground-white').each(function(index, e) {
console.log(index);
if(index > 9) {
$(e).hide();
}
... ... @@ -87,7 +90,7 @@ if ($('.back-ground-white').length > 10) {
$('.more-activity').click(function() {
$('.more-activity').hide();
$('.back-ground-white').each(function(index, e) {
if (index > 9) {
if(index > 9) {
$(e).show();
}
});
... ...
... ... @@ -45,17 +45,17 @@
.center-square {
position: absolute;
top: 50px;
width: 70%;
margin-left: 15%;
height: 200px;
margin-top: -106px;
margin-left: -193px;
width: 386px;
left: 50%;
top: 50%;
height: 212px;
}
.logo {
opacity: 1;
width: 100px;
height: auto;
margin-bottom: 10px;
margin-top: 20px;
}
.num {
... ... @@ -66,8 +66,10 @@
.title {
text-align: center;
font-size: 28px;
font-size: 32px;
font-weight: bold;
height: 40px;
line-height: 40px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
... ...