Authored by liangxs

奥莱活动楼层

... ... @@ -17,7 +17,7 @@ exports.index = (req, res) => {
let channel = req.query.channel || req.cookies._Channel || 'boys';
let headerData = headerModel.setNavHeader('OUTLET', channel, true, '', null);
outletModel.getContent().then(result => {
outletModel.getContent(channel).then(result => {
res.render('outlet', Object.assign({
pageHeader: headerData,
pageFooter: true
... ... @@ -40,14 +40,17 @@ exports.activity = (req, res) => {
};
exports.willBeEnd = (req, res) => {
outletModel.willBeEnd().then(result => {
console.log(result);
let channel = req.query.channel || req.cookies._Channel || 'boys';
outletModel.getNearlyActivity(channel, 2).then(result => {
res.render('outlet/will-end', Object.assign(renderData, result));
});
};
exports.willBeCome = (req, res) => {
outletModel.willBeCome().then(result => {
let channel = req.query.channel || req.cookies._Channel || 'boys';
outletModel.getNearlyActivity(channel, 3).then(result => {
res.render('outlet/will-start', Object.assign(renderData, result));
});
};
... ...
... ... @@ -116,8 +116,6 @@ const getActivityDetail = (id) => {
const convertActicityData = (data) => {
const formatData = [];
var showMore = false;
var i;
data = data || [];
_.forEach(data, (item) => {
... ... @@ -127,48 +125,43 @@ const convertActicityData = (data) => {
logoUrl: item.logoUrl,
title: item.title,
promotionName: item.promotionName,
startLeftTime: item.startLeftTime,
leftTime: item.startLeftTime > 0 ? item.startLeftTime : item.endLeftTime,
hide: false
});
});
if (formatData.length > 10) {
for (i = 10; i < formatData.length; i++) {
formatData[i].hide = true;
}
showMore = true;
}
return {data: formatData, showMore: showMore};
return formatData;
};
const getHomeActivity = (id) => {
const getHomeActivity = (data) => {
var params = {
method: 'app.outlets.activityGet',
platform: 2,
size: 0,
yh_channel: 1,
type: 0,
sort: 2,
client_type: 'h5'
};
return api.get('', sign.apiSign(params)).then(res => {
if (id === 0) {
return convertActicityData(res.data);
}
return res.data;
return api.get('', sign.apiSign(_.assign(params, data))).then(res => {
return convertActicityData(res.data);
});
};
exports.getContent = () => {
let floorsData = {};
exports.getContent = (channel) => {
let floorsData = {},
params = {
type: 0,
id: 0
};
return Promise.all([getNavData(), getOutletResource(), getHomeActivity(0), getGoodsList()]).then(data => {
if (channel === 'boys') {
params.yh_channel = 1;
}
return Promise.all([getNavData(), getOutletResource(), getHomeActivity(params), getGoodsList()]).then(data => {
floorsData.nav = data[0] || [];
floorsData.content = data[1] || [];
floorsData.activity = data[2] || [];
floorsData.activity = {data: data[2]};
floorsData.goods = data[3];
return floorsData;
... ... @@ -186,20 +179,16 @@ exports.getActivity = (id) => {
});
};
exports.willBeEnd = () => {
return getHomeActivity().then(res => {
var data = {
activity: {
data: res
}
};
exports.getNearlyActivity = (channel, type) => {
var params = {
type: type
};
return data;
});
};
if (channel === 'boys') {
params.yh_channel = 1;
}
exports.willBeCome = () => {
return getHomeActivity().then(res => {
return getHomeActivity(params).then(res => {
var data = {
activity: {
data: res
... ...
<div class="outlet-page">
{{log activity}}
{{# activity}}
{{#data}}
<a class="will-end-back" href="{{activityUrl}}" >
<img class="back-image" src="{{image coverUrl 640 300}}">
<div class="last-time">{{startLeftTime}}</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}}
{{> resources/acivity-outlets}}
{{/ activity}}
</div>
... ...
<div id="demo1">
<p>1 默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒</p>
<div class="cd cd-lite" data-config="{'leftTime':10}">剩余时间:${d}天${h}时${m}分${s}秒</div>
<div class="cd cd-medium" data-config="{'leftTime':10}">剩余时间:${h}时${m}分${s}秒</div>
<!--<p>1 默认,服务端输出leftTime,把客户端时间干扰降到最低。单位秒</p>-->
<div class="cd cd-lite time" data-config="{'leftTime':{{leftTime}} }">— 仅剩${d}天${h}时${m}分${s}秒 —</div>
<!--<div class="cd cd-medium" data-config="{'leftTime':82390943}">剩余时间:${h}时${m}分${s}秒</div>-->
</div>
<div id="demo4">
<p>2 notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s</p>
<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>
<div class="cd cd-large cd-slide" data-config="{'stopPoint':4529059200000,'effect':'slide'}">剩余时间:<span class="clock">${d}天${h}时${m}分${s}秒</span></div>
</div>
\ No newline at end of file
<!--<div id="demo4">-->
<!--<p>2 notify:cd.notify(xx, fn); 当倒计时还剩xx秒时调用fn,精准度为 1s</p>-->
<!--<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>-->
<!--<div class="cd cd-large cd-slide" data-config="{'stopPoint':4529059200000,'effect':'slide'}">剩余时间:<span class="clock">${d}天${h}时${m}分${s}秒</span></div>-->
<!--</div>-->
... ...
... ... @@ -5,7 +5,7 @@
<img class="logo" src="{{image logoUrl 150 100}}"></img>
<div class="title">{{title}}</div>
<div class="num">{{promotionName}} </div>
<div class="time">{{startLeftTime}}</div>
{{>product/outlet/countdown}}
</div>
</a>
{{/data}}
... ...
var $ = require('yoho-jquery'),
Swiper = require('yoho-swiper'),
lazyLoad = require('yoho-jquery-lazyload');
lazyLoad = require('yoho-jquery-lazyload'),
Countdown = require('./outlet/countdown');
var el = $('.cd-lite');
// var nav = require('./outlet/nav');
... ... @@ -12,8 +15,9 @@ lazyLoad($('img.lazy'));
// navClass: '.outlet-nav'
// })
new Countdown.Countdown({
el: el
});
if ($('.swiper-container .swiper-slide').length > 1) {
new Swiper('.swiper-container', {
... ...
... ... @@ -42,7 +42,7 @@
.center-square {
position: absolute;
background: #fffefa;
background: rgba(255, 255, 255, 0.5);
opacity: 0.9;
top: 50px;
width: 70%;
... ... @@ -54,6 +54,7 @@
opacity: 1;
width: 100px;
height: auto;
margin-bottom: 10px;
}
.num {
... ...