Authored by wangqing

模板微调

... ... @@ -84,7 +84,7 @@
{{# subnav}}
<li class="sub-nav-item">
<a href="{{link}}">{{name}} {{#is_new}}<span class="newlogo"></span>{{/is_new}}</a>
{{# thirdnav}}
{{#if thirdnav}}
<div class="third-nav-wrapper">
<div class="third-nav">
<div class="categorywrapper" id="category{{../index_main}}{{index_sub}}">
... ... @@ -110,7 +110,7 @@
</div>
</div>
</div>
{{/thirdnav}}
{{/if}}
</li>
{{/ subnav}}
</ul>
... ...
... ... @@ -6,7 +6,6 @@
var $ = require('yoho.jquery');
var handlebars = require('yoho.handlebars');
var json2 = require('json2');
var noticeSuccess = false; //服务器状态变量
var vipInfoCombine = null; //用户信息编译模板
var loginInfoCombine = null; //登录信息编译模板
var apiDomain = 'http://api.open.yohobuy.com'; //获取数据的地址
... ... @@ -205,7 +204,7 @@ function actionGoodsCart() {
};
var params = '';
if (typeof(domain) === undefined || domain === '') {
if (typeof (domain) === undefined || domain === '') {
console.log('请设置请求的api地址');
return false;
}
... ... @@ -218,7 +217,7 @@ function actionGoodsCart() {
try {
$.getJSON(domain + '/?callback=?', params, function(_data) {
if (onSuccess !== '') {
if(typeof onSuccess(_data.data) !=='undefined'){
if (typeof onSuccess(_data.data) !== 'undefined') {
json2.parse(onSuccess(_data.data));
}
return false;
... ... @@ -238,7 +237,7 @@ function actionGoodsCart() {
return shoppingData._k;
}
});
};
}
/**
* 判断为1的helper
* @param {[type]} v1 [description]
... ... @@ -302,42 +301,9 @@ function JsonPCallBack(data) {
}
}
/**
* 获取头部服务器维护的回调
* @param {[type]} data [description]
*/
function NoticeCallBack(data) {
if (+data.code === 200) {
noticeSuccess = true;
}
}
window.JsonPCallBack = JsonPCallBack;
window.NoticeCallBack = NoticeCallBack;
/**
* 检测是否获得公告
* @return {[type]} [description]
*/
function checkNotice() {
var noticeinner;
if (!noticeSuccess) {
noticeinner = '<div class="noticewrapper">' +
'<div class="noticecontainer">' +
'<h1 class="noticetitle">关于系统升级的公告</h1>' +
'<div class="noticecontent">' +
'<p class="tips">尊敬的顾客:</p>' +
'<p class="detail">您好!为了向您提供更优质的服务,目前系统正在升级,请耐心等待。</p>' +
'<p class="detail">' +
'系统升级期间,部分地区用户体验会有暂时中断,如遇紧急事宜,欢迎垂询客服热线:400-889-9646 09:00-22:30(周一至周日)。稍后系统将恢复正常' +
'</p>' +
'<p class="detail">使用,欢迎您继续光顾YOHO!BUY有货!带来不便之处深表歉意,请您谅解!</p>' +
'</div>' +
'</div>' +
'</div>';
$('.header-topwrapper').append(noticeinner);
}
}
/**
* 获得banner数据
* @param {[string]} code [banner对应的编码]
... ... @@ -350,19 +316,7 @@ function getBannerData(code) {
code + '&client_type=web&callback=JsonPCallBack';
document.getElementsByTagName('head')[0].appendChild(script);
}
/**
* 获取公告的jsonp请求
* @param {[type]} code [description]
* @return {[type]} [description]
*/
function getNoticeData(code) {
var script = document.createElement('script');
script.src = 'http://new.yohobuy.com/resource/getbanner?content_code=' +
code + '&client_type=web&callback=NoticeCallBack';
document.getElementsByTagName('head')[0].appendChild(script);
window.setTimeout(checkNotice, 5000); //5s后检测是否成功
}
/**
* 显示和隐藏
* @param {[type]} sourceClass [description]
... ... @@ -645,11 +599,10 @@ function actionExeCookieMap() {
for (i = 0; i < cookiearr.length; i++) {
temparr = cookiearr[i].split('=');
if(typeof temparr[0] !== 'undefined'){
if (typeof temparr[0] !== 'undefined') {
key = temparr[0].replace(/\s/g, '');
cookieMap[key] = temparr[1];
}
}
}
/**
... ...