Authored by 郭成尧

Merge branch 'feature/sale' of git.yoho.cn:fe/yohobuy-node into feature/sale

 the commit.
... ... @@ -5,7 +5,7 @@
<ul>
{{# list}}
<li class="banner-img" style="background: {{bgColor}} url({{image src 1920 450}}) no-repeat top center;">
{{#if href}}
{{#if url}}
<a href="{{url}}" target= "_blank"></a>
{{/if}}
</li>
... ... @@ -13,8 +13,8 @@
</ul>
</div>
{{^}}
{{#if href}}
<a href="{{href}}"></a>
{{#if url}}
<a href="{{url}}"></a>
{{/if}}
{{/if}}
</div>
... ...
... ... @@ -7,12 +7,62 @@
var $ = require('yoho-jquery'),
lazyLoad = require('yoho-jquery-lazyload');
var limitTime = [];
// require('../common');
// require('../outlets/channel');
require('../common/slider');
lazyLoad($('img.lazy'));
function convertTime(time) {
var anHour = 3600000,
aMinute = 60000,
aSecond = 1000,
showTime = '',
d = 0,
h = 0,
m = 0,
s = 0;
if (time > 1000) {
d = Math.floor(time / anHour / 24);
h = Math.floor(time / anHour % 24);
m = Math.floor(time / aMinute % 60);
s = Math.floor(time / aSecond % 60);
showTime += d > 0 ? d + '天' : '';
showTime += h > 0 ? h + '小时' : '';
showTime += m > 0 ? m + '分钟' : '';
showTime += s > 0 ? s + '秒' : '';
}
return showTime;
}
function setPageTime() {
var i, showTime;
for (i = 0; i < limitTime.length; i++) {
limitTime[i].time -= 1000;
showTime = convertTime(limitTime[i].time);
limitTime[i].dom.text(showTime);
}
}
$('.time').each(function() {
var data = $(this).data();
if (data.limit) {
limitTime.push({
dom: $(this),
time: data.limit
});
}
});
setInterval(setPageTime, 1000);
$('.slide-container').slider({
orient: true
});
... ...