Authored by 郭成尧

bottom-bar-ok

... ... @@ -41,3 +41,18 @@ exports.sidebar = function(req, res, next) {
});
}).catch(next);
};
exports.bottombar = function(req, res, next) {
model.index({
code: req.params.code
}).then((result) => {
if (!result) {
return next();
}
res.render('feature/bottombar', {
content: result,
layout: false
});
}).catch(next);
};
... ...
... ... @@ -104,6 +104,10 @@ module.exports = {
shopGroups.push(_getShopGroup(f.component[0]));
}
if (_.get(f, 'type') === 'bottombar') {
f.size = _.size(f.component);
}
_.forEach(f.component, function(component) {
if (component.persenal_enable === '1') {
f.hide = true; // 个性化券楼层先不展示,前端异步查询到的时候,再展示
... ...
... ... @@ -250,6 +250,7 @@ router.get('/individuation/coupon', individuation.coupon);
// 活动页模版
router.get('/feature/:code.html', feature.index);
router.get('/featuresidebar/:code.html', feature.sidebar);
router.get('/featurebottombar/:code.html', feature.bottombar);
// 2016 年度账单
router.get('/annual-account', annualAccount.index);
... ...
<div class="bottom-bar">
<div class="bottom-bar-content">
{{#content.floors}}
{{#isEqualOr type '' 'common_floor'}}
<div class="bottom-bar-item">
{{#if param.bgimg}}<img src="{{image2 param.bgimg q=60}}">{{/if}}
{{#component}}
{{#isEqualOr type 'link'}}
{{#isEqualOr url 'closesidebar'}}
<a class="anchor closesidebar" style="{{styleFormat this percent=1}}" href="javascript:void(0);"></a>
{{else}}
<a class="anchor" style="{{styleFormat this percent=1}}" href="{{#if url}}{{url}}{{else}}javascript:void(0);{{/if}}"></a>
{{/isEqualOr}}
{{/isEqualOr}}
{{/component}}
</div>
{{/isEqualOr}}
{{/content.floors}}
</div>
</div>
\ No newline at end of file
... ...
... ... @@ -102,6 +102,9 @@
{{/component}}
</div>
{{/isEqualOr}}
{{#isEqualOr type 'bottombar'}}
{{> feature/bottom-fix}}
{{/isEqualOr}}
{{/content.floors}}
{{/unless}}
</div>
... ...
<div class="bottom-fix" data-size="{{size}}">
{{#if param.bgimg}}
{{#isLazyLoad type @index}}
<img class="lazy" data-original="{{image2 param.bgimg q=95}}">
{{else}}
<img src="{{image2 param.bgimg q=95}}">
{{/isLazyLoad}}
{{/if}}
<div class="show-area" id="bottomShowArea">
{{#component}}
<div class="per-show hide" style="width: {{width}}%;left:{{left}}%" id="bottomShow{{url}}">
</div>
{{/component}}
</div>
<div class="click-area" id="bottomFixClickArea">
{{#component}}
<div class="per-click" style="width: {{width}}%;height:{{height}}%" data-url="{{url}}" id="bottomClick{{url}}">
</div>
{{/component}}
</div>
</div>
... ...
... ... @@ -64,7 +64,9 @@ function ceXuanFuInit() {
return;
}
$('#sidebar').load('//activity.yoho.cn/featuresidebar/' + pageid + '.html', function() {
// //m.yohobuy.com/activity/featuresidebar/
// //activity.yoho.cn/featuresidebar/
$('#sidebar').load('//m.yohobuy.com/activity/featuresidebar/' + pageid + '.html', function() {
$('.sidebar-img').click(function() {
$('.sidebar').show();
});
... ... @@ -82,6 +84,28 @@ function ceXuanFuInit() {
});
}
function diXuanFuInit() {
let $bottomFixClickArea = $('#bottomFixClickArea');
let $bottomPerShow = $('.per-show');
$bottomPerShow.css('bottom', $bottomFixClickArea.height());
$bottomFixClickArea.children().each((index, elem) => {
let pageId = $(elem).data('url');
let $bottomShow = $('#bottomShow' + pageId);
$bottomShow.load('//m.yohobuy.com/activity/featurebottombar/' + pageId + '.html');
$('#bottomClick' + pageId).on('click', () => {
if ($bottomShow.hasClass('hide')) {
$bottomShow.removeClass('hide');
} else {
$bottomShow.addClass('hide');
}
});
});
}
function videoInit() {
function cancelMove(e) {
e.preventDefault && e.preventDefault();
... ... @@ -242,6 +266,9 @@ $(function() {
// 侧悬浮
ceXuanFuInit();
// 底悬浮
diXuanFuInit();
// 视频相关
videoInit();
... ...
... ... @@ -4,3 +4,4 @@
@import "feature/product";
@import "feature/swiper.min";
@import "feature/shop";
@import "feature/bottom";
... ...
.bottom-fix {
position: fixed;
left: 0;
bottom: 0;
z-index: 1;
width: 100%;
img {
display: block;
width: 100%;
height: 100%;
}
.show-area {
position: absolute;
width: 100%;
.per-show {
position: fixed;
}
.hide {
display: none;
}
}
.click-area {
position: absolute;
top: 0;
bottom: 0;
width: 100%;
.per-click {
float: left;
}
}
}
... ...