Authored by yyq

Merge branch 'hotfix/topbanner'

... ... @@ -5,14 +5,14 @@
{{#list}}
<li class="{{channel}}" >
<dl>
<dt class="tag_img_warpper">
<dt class="tag-img-warpper">
<a href="{{url}}" target="_self">
<img spm-name="homepage_guide_manimg" alt="YOHO!BOYS" src="{{image src 180 168}}"></a>
</dt>
<dd class="block_cn">{{sort_name}}</dd>
<dd class="block_en"> <b>{{sort_name_en}}</b>
<dd class="block-cn">{{sort_name}}</dd>
<dd class="block-en"> <b>{{sort_name_en}}</b>
</dd>
<dd class="block_line">
<dd class="block-line">
</dd>
<dd class="goods-num"> <b>{{num}}+ Items.</b>
</dd>
... ...
... ... @@ -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;">&nbsp;</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();
... ...
.yoho-notice {
width: 100%;
height: 100px;
font-size: 12px;
background-color: #555;
font-family: '微软雅黑';
.notice-title {
height: 100px;
line-height: 100px;
font-size: 27px;
font-weight: bold;
color: #fff;
width: 245px;
position: absolute;
}
.notice-content {
padding: 16px 0 0 300px;
color: #e8e8e8;
.tips {
margin-bottom: 10px;
}
.detail {
line-height: 16px;
}
}
}
.yoho-header {
.tool-wrapper {
width: 100%;
... ... @@ -794,8 +825,8 @@
}
#cover {
left: 0px;
top: 0px;
left: 0;
top: 0;
width: 100%;
height: 100%;
position: fixed;
... ... @@ -803,8 +834,8 @@
.con {
background: rgba(0, 0, 0, 0.6) !important;
left: 0px;
top: 0px;
left: 0;
top: 0;
width: 100%;
height: 100%;
position: absolute;
... ... @@ -812,8 +843,8 @@
opacity: 0.5;
}
.tag_img_warpper {
margin: 0px auto;
.tag-img-warpper {
margin: 0 auto;
width: 180px;
height: 168px;
... ... @@ -825,7 +856,7 @@
.guide-box {
background: rgb(255, 255, 255);
margin: 0px auto;
margin: 0 auto;
height: 400px;
position: relative;
z-index: 1003;
... ... @@ -906,7 +937,7 @@
}
.go {
margin: 26px auto 0px;
margin: 26px auto 0;
width: 100%;
height: 18px;
text-align: center;
... ... @@ -920,7 +951,7 @@
}
}
.boys .block_cn {
.boys .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -928,7 +959,7 @@
margin-top: 30px;
}
.girls .block_cn {
.girls .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -936,7 +967,7 @@
margin-top: 30px;
}
.kids .block_cn {
.kids .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -944,7 +975,7 @@
margin-top: 30px;
}
.lifestyle .block_cn {
.lifestyle .block-cn {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -952,7 +983,7 @@
margin-top: 30px;
}
.boys .block_en {
.boys .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -960,7 +991,7 @@
margin-top: 19px;
}
.girls .block_en {
.girls .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -968,7 +999,7 @@
margin-top: 19px;
}
.kids .block_en {
.kids .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -976,7 +1007,7 @@
margin-top: 19px;
}
.lifestyle .block_en {
.lifestyle .block-en {
text-align: center;
line-height: 26px;
font-size: 26px;
... ... @@ -984,57 +1015,57 @@
margin-top: 19px;
}
.boys .block_cn,
.boys .block_en {
.boys .block-cn,
.boys .block-en {
color: #000;
}
.girls .block_cn,
.girls .block_en {
.girls .block-cn,
.girls .block-en {
color: rgb(255, 136, 174);
}
.kids .block_cn,
.kids .block_en {
.kids .block-cn,
.kids .block-en {
color: rgb(122, 217, 248);
}
.lifestyle .block_cn,
.lifestyle .block_en {
.lifestyle .block-cn,
.lifestyle .block-en {
color: rgb(79, 64, 55) !important;
}
.boys .block_line {
margin: 20px auto 0px;
.boys .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
}
.girls .block_line {
margin: 20px auto 0px;
.girls .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
}
.kids .block_line {
margin: 20px auto 0px;
.kids .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
}
.lifestyle .block_line {
margin: 20px auto 0px;
.lifestyle .block-line {
margin: 20px auto 0;
width: 50px;
height: 0px;
height: 0;
border-bottom-color: rgb(204, 204, 204);
border-bottom-width: 1px;
border-bottom-style: solid;
... ...