Authored by shuaiguo

Merge branch 'develop'

... ... @@ -78,10 +78,6 @@ exports.getIndexGuide = (req, res, next) => {
return req.ctx(ChannelModel).formatIndexGuideData(data.data);
}).then(data => {
return req.ctx(ChannelModel).getResourceData(data);
}).then(data => {
let result = {list: data, layout: false};
res.render('guide', result);
}).catch(next);
};
... ...
... ... @@ -32,7 +32,11 @@ module.exports = class extends global.yoho.BaseModel {
super(ctx);
this.searchApi = new SearchApi(ctx);
this.getGoodsFloor = {
最新上架: 'newArrivls',
// 新增导航: 'newFloor'
};
this.floorMap = {
slide: this._getSlideData.bind(this),
hot: this._getHotGoodsFloorData.bind(this),
... ... @@ -42,7 +46,9 @@ module.exports = class extends global.yoho.BaseModel {
'BOY KIDS': this._getSingleHotFloorData.bind(this),
ACCESSORIES: this._getSingleHotFloorData.bind(this),
优选品牌: this._getPreBrandTopData.bind(this),
最新上架: this._getNewGoodsFloorData.bind(this),
最新上架: this._getGoodsFloorData.bind(this),
// 新增导航: this._getGoodsFloorData.bind(this),
ad: this._getadbannerData.bind(this),
category: this._getCategoryFloorData.bind(this),
accordion: this._getAccordionFloorData.bind(this),
... ... @@ -592,17 +598,22 @@ module.exports = class extends global.yoho.BaseModel {
* @param string data
* return obj
*/
_getNewGoodsFloorData(args) {
_getGoodsFloorData(args) {
// console.log(args);
let name = args[0].data.text;
let floorKey = this.getGoodsFloor[name];
const data = {};
if (!_.isEmpty(args)) {
data.newArrivls = {
data[floorKey] = {
floorId: args[0].template_id,
name: _.replace(args[0].data.text, '最新', '新品'),
name: name === '最新上架' ? _.replace(name, '最新', '新品') : name,
templateName: floorKey,
navs: []
};
data.newArrivls.navs = args[1] ? args[1].data : {};
data[floorKey].navs = args[1] ? args[1].data : {};
}
return data;
}
... ... @@ -628,7 +639,7 @@ module.exports = class extends global.yoho.BaseModel {
}
if (resData.floorHeader.name.indexOf('最新上架') >= 0) {
resData = this._getNewGoodsFloorData(args);
resData = this._getGoodsFloorData(args);
}
return resData;
}
... ... @@ -1215,6 +1226,7 @@ module.exports = class extends global.yoho.BaseModel {
* @return {Object}
*/
getContent(type, isJKChannel, poolId) {
let that = this;
let params = {new_device: 'Y'};
const headerModelCtx = new HeaderModel(this.ctx);
... ... @@ -1237,11 +1249,15 @@ module.exports = class extends global.yoho.BaseModel {
data.pageType = type;
data.footerTop = true;
data.channel = processResult.floors.map(function(elem) {
let keyArr = Object.values(that.getGoodsFloor);
let tarKey = Object.keys(elem)[0];
if (elem.newArrivls) {
elem.newArrivls.goods = res[2];
}
if (keyArr.includes(tarKey)) {
// console.log(tarKey);
elem[tarKey].goods = res[2];
// console.log(elem[tarKey]);
}
return elem;
});
... ...
... ... @@ -86,6 +86,10 @@
{{# newArrivls}}
{{> commodity}}
{{/ newArrivls}}
{{! 新分类楼层}}
{{!-- {{# newFloor}}
{{> new-category}}
{{/ newFloor}} --}}
{{! 七个类别列表}}
{{# sevenCategory}}
{{> seven-product}}
... ...
<div class="commodity clearfix" id="newarrivals">
{{> common/floor-header}}
<div class="goods-container clearfix">
{{> product/new-arrivis}}
</div>
</div>
... ...
... ... @@ -24,11 +24,11 @@
</div>
<div id="tab-box">
<ul class="tabs" id="tabs">
{{!-- <ul class="tabs" id="tabs">
{{# pay}}
<li{{#if selected}} class="active"{{/if}}>{{name}}</li>
{{/pay}}
</ul>
</ul> --}}
<ul class="tab-conbox">
{{# pay}}
... ...
... ... @@ -51,7 +51,8 @@ const getMenuData = () => (
* @param {String} type 频道类型
* @return {array} 导航数组
*/
const getNavBar = (data, type) => {
const getNavBar = (data) => {
// 统一默认为boys
let navBars = [];
_.forEach(data, item => {
... ... @@ -59,16 +60,18 @@ const getNavBar = (data, type) => {
let lowEn = _.camelCase(item.sort_name_en).toLowerCase();
Object.assign(obj, {
type: lowEn,
// type: lowEn,
type: 'boys',
link: item.sort_url,
cn: item.sort_name,
en: item.sort_name_en,
isNewPage: item.is_new_page === 'Y'
});
if (type === lowEn) {
obj.active = true;
}
// if (type === lowEn) {
// obj.active = true;
// }
obj.active = true;
// 奥莱频道显示图片,特殊处理
if (lowEn === 'outlets') {
... ... @@ -144,7 +147,7 @@ const getThirdNav = (data) => {
* @param {String} type 频道类型
* @return {array} 子菜单数组
*/
const getSubNavGroup = (data, type) => {
const getSubNavGroup = (data) => {
let subNavGroup = [];
_.forEach(data, it => {
... ... @@ -166,12 +169,15 @@ const getSubNavGroup = (data, type) => {
subNav.push(obj);
});
let lowEn = _.camelCase(it.sort_name_en).toLowerCase();
// let lowEn = _.camelCase(it.sort_name_en).toLowerCase();
subNavGroup.push({
subType: lowEn,
// subType: lowEn,
subType: 'boys',
subNav: subNav,
active: lowEn === type
active: true
// active: lowEn === type
});
});
... ...
... ... @@ -6,9 +6,9 @@
<li style="{{#if bgColor}}background:{{bgColor}}{{/if}}">
<a href="{{url}}" rel="nofollow" target= "_blank" title="{{title}}">
{{#if @first}}
<img src="{{image2 src w=1150 h=450}}" alt="{{title}}-YOHO!BUY有货">
<img src="{{image2 src w=1125 h=420}}" alt="{{title}}-YOHO!BUY有货">
{{^}}
<img class="lazy" data-original="{{image2 src w=1150 h=450}}" alt="{{title}}-YOHO!BUY有货">
<img class="lazy" data-original="{{image2 src w=1125 h=420}}" alt="{{title}}-YOHO!BUY有货">
{{/if}}
</a>
{{# tips}}
... ...
{
"name": "yohobuy-node",
"version": "6.9.20",
"version": "6.10.1",
"private": true,
"description": "A New Yohobuy Project With Express",
"repository": {
... ...
... ... @@ -44,9 +44,7 @@ if ($.inArray(homePage, ['boys', 'girls', 'kids', 'lifestyle']) > -1) {
lazyLoad($('img.lazy'));
if (homePage === 'boys') {
$('.slide-container').slider({
pagination: '.thumb-pagination'
});
$('.slide-container').slider();
} else {
$('.center-col').slider();
$('.slide-container').slider();
... ...
... ... @@ -42,7 +42,7 @@ var logoAngle = 0,
loopTime = 500,
reg = /^[\^\!\+\-\(\)\:\[\]\\\{\}\~\*\?\|\&\;\/]{0,}$/g;
var dataLayer = [];
// var dataLayer = [];
var cartTimer;
... ... @@ -127,19 +127,19 @@ handlebars.registerHelper('gt', function(v1, v2, options) {
}
});
function getSource(column, postition, event) {
dataLayer.push({
louceng: column,
weizhi: postition,
event: event
});
}
// function getSource(column, postition, event) {
// dataLayer.push({
// louceng: column,
// weizhi: postition,
// event: event
// });
// }
function closeCover() {
var $cover = $('#cover');
// function closeCover() {
// var $cover = $('#cover');
$cover.remove();
}
// $cover.remove();
// }
// 设置头部banner
function setTopBanner(data) {
... ... @@ -816,100 +816,100 @@ $subNav.on({
* 首次进入有弹窗
* @return {[type]} [description]
*/
function actionCover() {
var gender = window.cookie('_Gender');
var newMask = '';
var windowheight = '';
var selfheight = '';
var containertop;
var length = '';
if (window.location.href === document.location.protocol + '//www.yohobuy.com/' &&
(typeof gender === 'undefined' || gender === '' || gender === null)) {
$.get('/guide', function(data) {
newMask = document.createElement('div');
newMask.id = 'cover';
newMask.innerHTML = data;
document.body.appendChild(newMask);
windowheight = $(window).height();
selfheight = $('.guide-box').height();
containertop = windowheight / 2 - selfheight / 2;
length = $('.guide-box .clear').find('li').length;
$('.guide-box').css({
width: (200 * length) + 'px',
top: containertop + 'px'
});
$('#cover').bind('click', function() {
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
$('#cover .guide-box .close').bind('click', function() {
getSource('弹窗', 'CLOSE', 'homepage_man');
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
$('.boys img , .boys .go').bind('click', function() {
getSource('弹窗', 'BOYS', 'homepage_man');
window.setCookie('_Gender', '1,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'boys', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
closeCover();
});
$('.girls img, .girls .go').bind('click', function() {
getSource('弹窗', 'GIRLS', 'homepage_woman');
window.setCookie('_Gender', '2,3', {
path: '/',
domain: '.yohobuy.com',
expires: 90
});
window.setCookie('_Channel', 'girls', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
});
$('.lifestyle img, .lifestyle .go').bind('click', function() {
window.setCookie('_Channel', 'lifestyle', {
path: '/',
domain: '.yohobuy.com',
expires: 7
});
getSource('弹窗', 'LIEFSTYLE', 'homepage_lifestyle');
});
$('#cover .guide-box').bind('click', function(event) {
event.stopPropagation();
});
});
$('#cover .guide-box').bind('click', function(e) {
e.stopPropagation();
});
}
}
// function actionCover() {
// var gender = window.cookie('_Gender');
// var newMask = '';
// var windowheight = '';
// var selfheight = '';
// var containertop;
// var length = '';
// if (window.location.href === document.location.protocol + '//www.yohobuy.com/' &&
// (typeof gender === 'undefined' || gender === '' || gender === null)) {
// $.get('/guide', function(data) {
// newMask = document.createElement('div');
// newMask.id = 'cover';
// newMask.innerHTML = data;
// document.body.appendChild(newMask);
// windowheight = $(window).height();
// selfheight = $('.guide-box').height();
// containertop = windowheight / 2 - selfheight / 2;
// length = $('.guide-box .clear').find('li').length;
// $('.guide-box').css({
// width: (200 * length) + 'px',
// top: containertop + 'px'
// });
// $('#cover').bind('click', function() {
// window.setCookie('_Gender', '1,3', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 90
// });
// window.setCookie('_Channel', 'boys', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 7
// });
// closeCover();
// });
// $('#cover .guide-box .close').bind('click', function() {
// getSource('弹窗', 'CLOSE', 'homepage_man');
// window.setCookie('_Gender', '1,3', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 90
// });
// window.setCookie('_Channel', 'boys', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 7
// });
// closeCover();
// });
// $('.boys img , .boys .go').bind('click', function() {
// getSource('弹窗', 'BOYS', 'homepage_man');
// window.setCookie('_Gender', '1,3', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 90
// });
// window.setCookie('_Channel', 'boys', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 7
// });
// closeCover();
// });
// $('.girls img, .girls .go').bind('click', function() {
// getSource('弹窗', 'GIRLS', 'homepage_woman');
// window.setCookie('_Gender', '2,3', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 90
// });
// window.setCookie('_Channel', 'girls', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 7
// });
// });
// $('.lifestyle img, .lifestyle .go').bind('click', function() {
// window.setCookie('_Channel', 'lifestyle', {
// path: '/',
// domain: '.yohobuy.com',
// expires: 7
// });
// getSource('弹窗', 'LIEFSTYLE', 'homepage_lifestyle');
// });
// $('#cover .guide-box').bind('click', function(event) {
// event.stopPropagation();
// });
// });
// $('#cover .guide-box').bind('click', function(e) {
// e.stopPropagation();
// });
// }
// }
window.submitSearch = submitSearch;
... ... @@ -988,6 +988,6 @@ $(function() {
});
});
actionCover();
// actionCover(); //首次进入去除弹框
actionAddKeyWords();
... ...
... ... @@ -6,7 +6,7 @@
position: absolute;
left: 0;
right: 0;
height: 450px;
height: 430px;
}
.slide-thumb-container {
... ... @@ -15,7 +15,7 @@
.slide-wrapper {
position: relative;
height: 450px;
height: 430px;
overflow: hidden;
ul {
... ... @@ -54,7 +54,7 @@
}
.slide-container-placeholder {
height: 450px;
height: 430px;
width: 100%;
}
... ...
... ... @@ -4,7 +4,7 @@
/* 大banner */
.slide-container {
height: 387px;
height: 370px;
img {
display: block;
... ... @@ -16,7 +16,7 @@
}
.slide-container-placeholder {
height: 387px;
height: 370px;
}
.slide-thumb-container-placeholder {
... ... @@ -25,7 +25,7 @@
/* 大banner大图 */
.slide-wrapper {
height: 387px;
height: 370px;
li {
a {
... ...