...
|
...
|
@@ -32,6 +32,43 @@ var logoAngle = 0, |
|
|
|
|
|
var dataLayer = [];
|
|
|
|
|
|
// banner和地址的映射
|
|
|
var bannerMap = {
|
|
|
listboys: '4f78b0f418fc42314d8b6e791cfb7fa8',
|
|
|
listgirls: '00c1f025a51b6b597dc37925951ea27d',
|
|
|
listkids: 'b02df11184727701ade1b6de9737d08c',
|
|
|
listlifestyle: 'fd35c52dced0c880976ba858346d1fc5',
|
|
|
searchboys: '9fb8986ea700cc27a8057361c3924394',
|
|
|
searchgirls: 'e3e207a1443ca60c8037fe52a5560c18',
|
|
|
searchkids: '620fc77f479da8feaeb06f2324e5d0bb',
|
|
|
searchlifestyle: 'a3c93301c6ffaf3ed0f36a4a451be36d',
|
|
|
uniquebrandboys: '2ebb0810c0d1a67e5229149c9c3aba7d',
|
|
|
uniquebrandgirls: '99e23385f4ba4b65f406b7e2968ac821',
|
|
|
uniquebrandkids: 'a74ebc9b17840c91b9ea46568111fe6b',
|
|
|
uniquebrandlifestyle: '0e8c81ead53f56302baa4d0ad967f527',
|
|
|
brandsboys: '77b352db07129c76a9d532acad149f9f',
|
|
|
brandsgirls: 'bf047f16e52ebc38be5ce9c7623831e6',
|
|
|
brandskids: 'e3ae1ce9b5e13c6d271ef3eccb831652',
|
|
|
brandslifestyle: 'e4ac8029c30f65d7f1af030980d140fe',
|
|
|
newboys: '869d3c5f3b450fb52101d00a61ce87cb',
|
|
|
newgirls: 'd953b6dfdac02483d1dcce8d96055954',
|
|
|
newkids: '0874cb6d75df8e0e78f2d475e53ecc08',
|
|
|
newlifestyle: '43e8fc8e178115c262bbce2bd0012db7',
|
|
|
saleboys: 'c846e3165c994769b4201d8c32f3ae9b',
|
|
|
salegirls: '52b1d389edcbc62d65de71b80c4d6ad0',
|
|
|
salekids: 'ad8b1703c761ba00973868ab5199cc27',
|
|
|
salelifestyle: '7acc64905c70ac91846f43fb2cec4bbd',
|
|
|
homeboys: 'b0856a771ef1b59ab1234c74688fa42d',
|
|
|
homegirls: '2bd61fa12e4933211518f70fe5ce3c48',
|
|
|
homekids: '895c59e8c64b40399c9533509507320c',
|
|
|
homelifestyle: '2e037d4e25d2767352ca3e0a4627f7bd',
|
|
|
indexboys: '0c911d3000f52e8ca7cffb74f5864c29',
|
|
|
indexgirls: 'b645b8980c423ab30485e0a9d08c2ef7',
|
|
|
indexkids: '17f6d5d5d454d2c507bc5fcbc90f7756',
|
|
|
indexlifestyle: '735cd393e841762af8793c346abbbc36'
|
|
|
},
|
|
|
cookieMap = {};
|
|
|
|
|
|
// handlebars模板
|
|
|
centerFn = handlebars.compile($('#simple-account-info-tpl').html() || '');
|
|
|
loginFn = handlebars.compile($('#header-login-info-tpl').html() || '');
|
...
|
...
|
@@ -47,13 +84,11 @@ handlebars.registerHelper('notzero', function(v1, options) { |
|
|
});
|
|
|
|
|
|
function getSource(column, postition, event) {
|
|
|
try {
|
|
|
dataLayer.push({
|
|
|
louceng: column,
|
|
|
weizhi: postition,
|
|
|
event: event
|
|
|
});
|
|
|
} catch (e) {}
|
|
|
}
|
|
|
|
|
|
function closeCover() {
|
...
|
...
|
@@ -62,6 +97,117 @@ function closeCover() { |
|
|
$cover.remove();
|
|
|
}
|
|
|
|
|
|
// 设置头部banner
|
|
|
function setTopBanner(data) {
|
|
|
var topbanner = '';
|
|
|
|
|
|
if (data && data.url !== '') {
|
|
|
topbanner = '<a target="_blank" href="' + data.url + '" class="page-top-banner"' +
|
|
|
'style="height:36px;border:none;background-image:url(' + window.unescape(data.src) + ');' +
|
|
|
'background-position: center;display:block;"> </a>';
|
|
|
} else {
|
|
|
topbanner = '<div class="yoho-notice">' +
|
|
|
'<div class="notice-container center-content">' +
|
|
|
'<h1 class="notice-title">关于系统升级的公告</h1>' +
|
|
|
'<div class="notice-content">' +
|
|
|
'<p class="tips">尊敬的顾客:</p>' +
|
|
|
'<p class="detail">您好!为了向您提供更优质的服务,目前系统正在升级,请耐心等待。</p>' +
|
|
|
'<p class="detail">系统升级期间,部分地区用户体验会有暂时中断,如遇紧急事宜,欢迎垂询客服热线:' +
|
|
|
'400-889-9646 09:00-22:30(周一至周日)。稍后系统将恢复正常' +
|
|
|
'使用,欢迎您继续光顾YOHO!BUY有货!带来不便之处深表歉意,请您谅解!</p>' +
|
|
|
'</div>' +
|
|
|
'</div>' +
|
|
|
'</div>';
|
|
|
}
|
|
|
$('body').prepend(topbanner);
|
|
|
}
|
|
|
|
|
|
// cookie集合
|
|
|
function exeCookieMap() {
|
|
|
var cookies = document.cookie;
|
|
|
var cookiearr = cookies.split(';');
|
|
|
var i;
|
|
|
var temparr;
|
|
|
var key;
|
|
|
|
|
|
for (i = 0; i < cookiearr.length; i++) {
|
|
|
temparr = cookiearr[i].split('=');
|
|
|
if (typeof temparr[0] !== 'undefined') {
|
|
|
key = temparr[0].replace(/\s/g, '');
|
|
|
cookieMap[key] = temparr[1];
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 获得banner & 异常通知
|
|
|
* @return {[type]} [description]
|
|
|
*/
|
|
|
function getBannerAndNotice() {
|
|
|
var INDEXKIDS = 'indexkids',
|
|
|
INDEXLIFESTYLE = 'indexlifestyle',
|
|
|
INDEXBOYS = 'indexboys',
|
|
|
INDEXWOMAN = 'indexgirls',
|
|
|
UNIQUEBRAND = 'uniquebrand';
|
|
|
var url = window.location.href;
|
|
|
var host = window.location.host;
|
|
|
var code = '';
|
|
|
var firstarea;
|
|
|
|
|
|
exeCookieMap();
|
|
|
|
|
|
if (url.indexOf('search') !== -1) {
|
|
|
code = bannerMap['search' + cookieMap._Channel];
|
|
|
}
|
|
|
if (url.indexOf('list') !== -1) {
|
|
|
code = bannerMap['list' + cookieMap._Channel];
|
|
|
}
|
|
|
if (url.indexOf('brands') !== -1) {
|
|
|
code = bannerMap['brands' + cookieMap._Channel];
|
|
|
}
|
|
|
if (url.indexOf('new') !== -1) {
|
|
|
code = bannerMap['new' + cookieMap._Channel];
|
|
|
}
|
|
|
if (url.indexOf('sale') !== -1) {
|
|
|
code = bannerMap['sale' + cookieMap._Channel];
|
|
|
}
|
|
|
if (url.indexOf('home') !== -1) {
|
|
|
code = bannerMap['home' + cookieMap._Channel];
|
|
|
}
|
|
|
if (url.indexOf('kids') !== -1) {
|
|
|
code = bannerMap[INDEXKIDS];
|
|
|
}
|
|
|
if (url.indexOf('woman') !== -1 || url.indexOf('girls') !== -1) {
|
|
|
code = bannerMap[INDEXWOMAN];
|
|
|
}
|
|
|
if (url.indexOf('lifestyle') !== -1) {
|
|
|
code = bannerMap[INDEXLIFESTYLE];
|
|
|
}
|
|
|
if (url.indexOf('www.yohobuy.com') !== -1 && window.location.pathname === '/') {
|
|
|
code = bannerMap[INDEXBOYS];
|
|
|
}
|
|
|
firstarea = host.split('.')[0];
|
|
|
if (firstarea !== 'list' && firstarea !== 'search' && firstarea !== 'www' &&
|
|
|
firstarea !== 'new' && firstarea !== 'item' && firstarea !== 'guang') {
|
|
|
code = bannerMap[UNIQUEBRAND + cookieMap._Channel];
|
|
|
}
|
|
|
|
|
|
$.getJSON('//new.yohobuy.com/common/getbanner?callback=?', {
|
|
|
client_type: 'web',
|
|
|
content_code: code
|
|
|
}, function(JsonData) {
|
|
|
if (+JsonData.code === 200) {
|
|
|
if (typeof JsonData.data === 'object') {
|
|
|
if (JsonData.data.url !== '') {
|
|
|
setTopBanner(JsonData.data);
|
|
|
} else {
|
|
|
setTopBanner();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
// 格式化三级菜单
|
|
|
function formatThirdMenu() {
|
|
|
$subNav.each(function() {
|
...
|
...
|
@@ -336,9 +482,10 @@ if (isSupportCss3Animation()) { |
|
|
} else {
|
|
|
window.setTimeout(fadeAnimate, 3000);
|
|
|
}
|
|
|
syncLoginInfo();
|
|
|
formatThirdMenu();
|
|
|
setInterval(syncCratInfo, 2000);
|
|
|
getBannerAndNotice(); // 获取头部banner
|
|
|
syncLoginInfo(); // 同步登陆信息
|
|
|
formatThirdMenu(); // 格式化三级菜单
|
|
|
setInterval(syncCratInfo, 2000); // 定时同步购物车数量
|
|
|
|
|
|
$yohoGroup.hover(function() {
|
|
|
var data = $(this).data();
|
...
|
...
|
@@ -489,7 +636,7 @@ function actionCover() { |
|
|
width: (200 * length) + 'px',
|
|
|
top: containertop + 'px'
|
|
|
});
|
|
|
$('#cover').bind('click', function(event) {
|
|
|
$('#cover').bind('click', function() {
|
|
|
window.setCookie('_Gender', '1,3', {
|
|
|
path: '/',
|
|
|
domain: '.yohobuy.com',
|
...
|
...
|
@@ -502,7 +649,7 @@ function actionCover() { |
|
|
});
|
|
|
closeCover();
|
|
|
});
|
|
|
$('#cover .guide-box .close').bind('click', function(event) {
|
|
|
$('#cover .guide-box .close').bind('click', function() {
|
|
|
getSource('弹窗', 'CLOSE', 'homepage_man');
|
|
|
window.setCookie('_Gender', '1,3', {
|
|
|
path: '/',
|
...
|
...
|
@@ -516,7 +663,7 @@ function actionCover() { |
|
|
});
|
|
|
closeCover();
|
|
|
});
|
|
|
$('.boys img , .boys .go').bind('click', function(event) {
|
|
|
$('.boys img , .boys .go').bind('click', function() {
|
|
|
getSource('弹窗', 'BOYS', 'homepage_man');
|
|
|
window.setCookie('_Gender', '1,3', {
|
|
|
path: '/',
|
...
|
...
|
@@ -530,7 +677,7 @@ function actionCover() { |
|
|
});
|
|
|
closeCover();
|
|
|
});
|
|
|
$('.girls img, .girls .go').bind('click', function(event) {
|
|
|
$('.girls img, .girls .go').bind('click', function() {
|
|
|
getSource('弹窗', 'GIRLS', 'homepage_woman');
|
|
|
window.setCookie('_Gender', '2,3', {
|
|
|
path: '/',
|
...
|
...
|
@@ -543,7 +690,7 @@ function actionCover() { |
|
|
expires: 7
|
|
|
});
|
|
|
});
|
|
|
$('.lifestyle img, .lifestyle .go').bind('click', function(event) {
|
|
|
$('.lifestyle img, .lifestyle .go').bind('click', function() {
|
|
|
window.setCookie('_Channel', 'lifestyle', {
|
|
|
path: '/',
|
|
|
domain: '.yohobuy.com',
|
...
|
...
|
@@ -558,4 +705,4 @@ function actionCover() { |
|
|
}
|
|
|
}
|
|
|
|
|
|
// actionCover(); |
|
|
actionCover(); |
...
|
...
|
|