Authored by 王水玲

Merge branch 'develop' into feature/activity

... ... @@ -15,25 +15,25 @@
<ul class="two-dim clearfix">
<li class="left">
{{#if devEnv}}
<img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-app.png">
<img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-app.png">
{{^}}
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png">
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/qr-app.png">
{{/if}}
<p>YOHO!有货</p>
</li>
<li class="left">
{{#if devEnv}}
<img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-weixin.png">
<img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-weixin.png">
{{^}}
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png">
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/qr-app.png">
{{/if}}
<p>微信</p>
</li>
<li class="left">
{{#if devEnv}}
<img class="dim-img lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/qr-weibo.png">
<img class="dim-img lazy" data-original="http://localhost:3000/img/layout/qr-weibo.png">
{{^}}
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/qr-app.png">
<img class="dim-img lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/qr-app.png">
{{/if}}
<p>微博</p>
</li>
... ... @@ -41,7 +41,7 @@
</div>
</div>
<p class="item-nav center">
<span class="iconfont cur" key="0">&#xe619;</span>
<span class="iconfont cur" key="0">&#xe606;</span>
</p>
</dd>
<dd>
... ... @@ -121,9 +121,9 @@
</ul>
</div>
<p id="feed-back-page" class="item-nav center">
<span class="iconfont cur">&#xe619;</span>
<span class="iconfont ">&#xe619;</span>
<span class="iconfont ">&#xe619;</span>
<span class="iconfont cur">&#xe606;</span>
<span class="iconfont ">&#xe606;</span>
<span class="iconfont ">&#xe606;</span>
</p>
</dd>
<dd class="last">
... ... @@ -139,27 +139,27 @@
<li>
<a href="http://www.yohomars.com/" target="_blank">
{{#if devEnv}}
<img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/mars.png">
<img class="lazy" data-original="http://localhost:3000/img/layout/mars.png">
{{^}}
<img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/mars.png">
<img class="lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/mars.png">
{{/if}}
</a>
</li>
<li>
<a href="http://app.yohoshow.com/" target="_blank">
{{#if devEnv}}
<img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/show.png">
<img class="lazy" data-original="http://localhost:3000/img/layout/show.png">
{{^}}
<img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/show.png">
<img class="lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/show.png">
{{/if}}
</a>
</li>
<li>
<a href="http://www.yoho.cn/product#yoho" target="_blank">
{{#if devEnv}}
<img class="lazy" data-original="http://webstatic.dev.yohobuy.com/img/index/yoho.png">
<img class="lazy" data-original="http://localhost:3000/img/layout/yoho.png">
{{^}}
<img class="lazy" data-original="http://cdn.yoho.cn/yohobuy/assets/img/index/yoho.png">
<img class="lazy" data-original="http://cdn.yoho.cn/m-yohobuy-node/img/layout/yoho.png">
{{/if}}
</a>
</li>
... ... @@ -167,7 +167,7 @@
</div>
</div>
<p class="item-nav center">
<span class="iconfont cur">&#xe619;</span>
<span class="iconfont cur">&#xe606;</span>
</p>
</dd>
</dl>
... ...
{{# headerData}}
<div class="yoho-header {{headType}}">
<div class="yoho-header {{headtype}}">
<div class="tool-wrapper clearfix">
<div class="center-content">
<div class="yoho-group-map left">
... ... @@ -84,8 +84,10 @@
</form>
</div>
<div class="go-cart">
<a href="http://www.yohobuy.com/shopping/cart">
<span class="iconfont ">&#xe600;</span>
<span class="goods-num-tip">0</span>
</a>
<div class="mini-cart-wrapper">
<div class="loading-cart">
<h3>加载中,请稍后</h3>
... ...
No preview for this file type
... ... @@ -2,11 +2,11 @@
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
<svg xmlns="http://www.w3.org/2000/svg">
<metadata>
Created by FontForge 20120731 at Tue May 3 14:50:34 2016
Created by FontForge 20120731 at Wed May 11 14:40:20 2016
By admin
</metadata>
<defs>
<font id="iconfont" horiz-adv-x="1048" >
<font id="iconfont" horiz-adv-x="1024" >
<font-face
font-family="iconfont"
font-weight="500"
... ... @@ -19,7 +19,7 @@ Created by FontForge 20120731 at Tue May 3 14:50:34 2016
bbox="0 -212 1158 896"
underline-thickness="50"
underline-position="-100"
unicode-range="U+0078-E604"
unicode-range="U+0078-E606"
/>
<missing-glyph horiz-adv-x="374"
d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
... ... @@ -33,13 +33,13 @@ d="M34 0v682h272v-682h-272zM68 34h204v614h-204v-614z" />
d="M281 543q-27 -1 -53 -1h-83q-18 0 -36.5 -6t-32.5 -18.5t-23 -32t-9 -45.5v-76h912v41q0 16 -0.5 30t-0.5 18q0 13 -5 29t-17 29.5t-31.5 22.5t-49.5 9h-133v-97h-438v97zM955 310v-52q0 -23 0.5 -52t0.5 -58t-10.5 -47.5t-26 -30t-33 -16t-31.5 -4.5q-14 -1 -29.5 -0.5
t-29.5 0.5h-32l-45 128h-439l-44 -128h-29h-34q-20 0 -45 1q-25 0 -41 9.5t-25.5 23t-13.5 29.5t-4 30v167h911zM163 247q-12 0 -21 -8.5t-9 -21.5t9 -21.5t21 -8.5q13 0 22 8.5t9 21.5t-9 21.5t-22 8.5zM316 123q-8 -26 -14 -48q-5 -19 -10.5 -37t-7.5 -25t-3 -15t1 -14.5
t9.5 -10.5t21.5 -4h37h67h81h80h64h36q23 0 34 12t2 38q-5 13 -9.5 30.5t-9.5 34.5q-5 19 -11 39h-368zM336 498v228q0 11 2.5 23t10 21.5t20.5 15.5t34 6h188q31 0 51.5 -14.5t20.5 -52.5v-227h-327z" />
<glyph glyph-name="uniE600" unicode="&#xe600;"
<glyph glyph-name="uniE600" unicode="&#xe600;" horiz-adv-x="1048"
d="M832 -126.5q0 -35.5 -25 -60.5t-60.5 -25t-60.5 25t-25 60.5t25 60.5t60.5 25t60.5 -25t25 -60.5zM533 -126.5q0 -35.5 -25 -60.5t-60 -25t-60 25t-25 60.5t25 60.5t60 25t60 -25t25 -60.5zM277 620l-35 159q-3 14 -15 23.5t-27 9.5h-147q-22 0 -37.5 -15.5t-15.5 -37.5
t15.5 -38t37.5 -16h54l157 -627q6 -25 25.5 -40t44.5 -15h527q25 0 44.5 15t25.5 40l113 452q9 34 -13 62t-57 28h-697z" />
<glyph glyph-name="uniE601" unicode="&#xe601;" horiz-adv-x="1024"
<glyph glyph-name="uniE601" unicode="&#xe601;"
d="M505 337l2 -2q2 -1 3.5 -1t3.5 1l430 364q2 2 1 5.5t-5 3.5h-435h-424q-4 0 -5 -3.5t1 -5.5zM72 669q-3 2 -6 0.5t-3 -4.5v-584q0 -4 3.5 -5t5.5 1l288 346zM953 669.5q-3 1.5 -5 -0.5l-288 -246l287 -346q3 -2 6 -1t3 5v584q0 3 -3 4.5zM641 406l-131 -111l-5 5
l-125 103l-275 -328q-2 -3 -1 -6t5 -3h396h407q4 0 5 3t-1 6z" />
<glyph glyph-name="uniE602" unicode="&#xe602;"
<glyph glyph-name="uniE602" unicode="&#xe602;" horiz-adv-x="1048"
d="M297.5 528q-20.5 0 -35 -14.5t-14.5 -35t14.5 -35.5t35 -15t35.5 15t15 35.5t-15 35t-35.5 14.5zM381 251q0 96 84 164t202 68t202 -68t84 -163.5t-84 -163.5t-202 -68t-202 68t-84 163zM286 251q0 -17 2 -35v1q-88 42 -140.5 114t-52.5 157t51.5 157t139.5 114t192 42
q142 0 249.5 -76.5t128.5 -189.5q-88 43 -189 43q-104 0 -191.5 -43.5t-138.5 -119t-51 -164.5zM953 36q95 93 95 215t-94 214q2 20 2 23q0 111 -64 205t-174.5 148.5t-240 54.5t-239.5 -54.5t-174 -148.5t-64 -205q0 -78 33 -148.5t93 -125.5l-77 -123q-8 -12 -6.5 -26
t10.5 -25q13 -15 32 -15q9 0 18 4l180 80q4 2 7 4q20 -7 39 -12q48 -80 138.5 -128t199.5 -48q75 0 145 25q1 -1 2 -1l140 -62q8 -4 17 -4q20 0 32 15q10 10 11 24t-7 26zM527 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11.5 27t-27.5 11z
... ... @@ -47,8 +47,12 @@ M667 282q-16 0 -27.5 -11t-11.5 -27t11.5 -27.5t27.5 -11.5t27.5 11.5t11.5 27.5t-11
<glyph glyph-name="uniE603" unicode="&#xe603;" horiz-adv-x="1158"
d="M1069 181h-245v378h132l113 -169v-209zM1158 417l-155 231h-268v-467h-45v508q0 20 -14 34t-34 14h-63l-67 -89h89v-467h-512v467h45l22 89h-108q-20 0 -34 -14t-14 -34v-549q0 -20 14 -34t34 -14h139q-33 -37 -33 -87q0 -53 37.5 -91t91 -38t91.5 38t38 91q0 50 -34 87
h264h191q-34 -37 -34 -87q0 -53 38 -91t91.5 -38t91 38t37.5 91q0 50 -33 87h134v325zM326 668q-89 -153 -94 -296v-12h129v12q0 43 17 112q17 68 39 116q27 61 67.5 118t62.5 79l4 3v96h-390l-2 -114h245q-33 -40 -78 -114z" />
<glyph glyph-name="uniE604" unicode="&#xe604;" horiz-adv-x="1024"
<glyph glyph-name="uniE604" unicode="&#xe604;"
d="M875 126l-363 -164l-363 164v610q247 75 363 75t363 -75v-610zM930 808q-34 11 -84.5 26t-159.5 38.5t-174 23.5t-174 -23.5t-159.5 -38.5t-84.5 -26q-14 -4 -22 -15.5t-8 -25.5v-669q0 -27 25 -39l405 -183q9 -3 18 -3t18 3l405 183q25 12 25 39v669q0 14 -8 25.5
t-22 15.5zM751 552v83h-473v-83h206v-298h-72v237h-87v-237h-66v-84h506v84h-193v119h151v83h-151v96h179z" />
<glyph glyph-name="uniE605" unicode="&#xe605;"
d="M903 577l-68 69l-388 -388l-231 230l-68 -68l299 -298l65 65z" />
<glyph glyph-name="uniE606" unicode="&#xe606;"
d="M512 599q47 0 88 -18t72 -49t49 -72t18 -89q0 -46 -18 -87t-49 -72t-72 -49t-88 -18t-88 18t-72 49t-49 72t-18 87q0 48 18 89t49 72t72 49t88 18v0zM512 599z" />
</font>
</defs></svg>
... ...
No preview for this file type
No preview for this file type
/**
* 页面公共逻辑和接口
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/11/23
*/
var $ = require('yoho-jquery');
var $body = $('body');
function cookie(name) {
var re = new RegExp(name + '=([^;$]*)', 'i'),
matchPattern = '$1';
return re.test(decodeURIComponent(document.cookie)) ? RegExp[matchPattern] : '';
}
function setCookie(name, value, options) {
var expires = '',
path,
domain,
secure,
date;
if (typeof value !== 'undefined') {
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
if (options.expires &&
(typeof options.expires === 'number' || options.expires.toUTCString)) {
if (typeof options.expires === 'number') {
date = new Date();
date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
path = options.path ? '; path=' + options.path : '';
domain = options.domain ? '; domain=' + options.domain : '';
secure = options.secure ? '; secure' : '';
document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
}
}
function getUser() {
var c = cookie('_UID'),
user;
if (typeof c === 'undefined') {
return 0;
}
user = c.split('::');
if (typeof user === 'undefined' || user.length < 4) {
return 0;
}
return user;
}
function getUid() {
var user = getUser();
if (user === 0) {
return 0;
}
return user[1];
}
function getShoppingKey() {
var c = cookie('_g');
if (typeof c === 'undefined') {
return '';
}
return JSON.parse(c).k;
}
// YAS统计代码
(function(w, d, s, j, f) {
var a = d.createElement(s);
var m = d.getElementsByTagName(s)[0];
w.YohoAcquisitionObject = f;
w[f] = function() {
w[f].p = arguments;
};
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
}(window, document, 'script', 'http://cdn.yoho.cn/yas-jssdk/1.0.14/yas.js', '_yas'));
(function() {
var uid = getUid();
uid = uid === 0 ? '' : uid;
window._ozuid = uid; // 暴露ozuid
if (window._yas) {
window._yas(1 * new Date(), '1.0.14', 'yohobuy_web', uid, '', '');
}
}());
// window.resize在width<1180时适配成990
$(window).on('resize', function() {
var w = $(this).width();
// return top
if (w < 1360) {
$('.return-top').addClass('min');
} else {
$('.return-top').removeClass('min');
}
// body
if (w < 1180) {
$body.addClass('min-screen');
} else {
$body.removeClass('min-screen');
}
}).trigger('resize');
function queryString() {
var vars = {},
hash,
i,
search = window.location.search,
hashes = search ? decodeURIComponent(search).slice(1).split('&') : [];
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars[hash[0]] = hash[1];
}
return vars;
}
// 个人中心左侧栏头像加载失败后,显示默认头像
(function() {
$(window).load(function() {
var thumb = document.getElementById('user-thumb');
var img;
if (!thumb) {
return;
}
img = new Image();
img.src = thumb.src;
img.onerror = function() {
$(thumb).parent().append('<div class="default-user-thumb"></div>').end().remove();
};
});
}());
window.cookie = cookie;
window.setCookie = setCookie;
window.getUser = getUser;
window.getUid = getUid;
window.getShoppingKey = getShoppingKey;
window.queryString = queryString;
require('./header');
require('./footer');
... ...
/**
* 尾部
* @author: wangqing<robin.wang@yoho.cn>
* @date: 2015/12/01
*/
var $ = require('yoho-jquery');
var $returnTop = $('.return-top');
/**
* 订阅
* @return {[type]} [description]
*/
function actionSubscription() {
var $subscriberBox = $('#subscriber-box'),
$subscriberBtn = $('#subscriber-btn'),
emailReg = /^[.\-_a-zA-Z0-9]+@[\-_a-zA-Z0-9]+\.[a-zA-Z0-9]/;
var iconCode = {
mail: '&#xe601;',
tick: '&#xe605;'
};
$subscriberBox.focus(function() {
$(this).val('').css('color', '');
$subscriberBtn.removeClass('done').html(iconCode.mail);
});
$subscriberBtn.click(function() {
var email = $.trim($subscriberBox.val());
if (email !== '' && emailReg.test(email)) {
try {
$.ajax({
url: 'http://new.yohobuy.com/common/emailsubscriber',
dataType: 'jsonp',
data: {
email: email,
tmp: Math.random(),
uid: window.getUid()
},
success: function(data) {
if (data.data.result === 1) {
$subscriberBox.val('已订阅到:' + email);
$subscriberBtn.addClass('done').html(iconCode.tick);
} else {
$subscriberBox.css('color', 'red');
}
}
});
} catch (e) {
console.log(e.message);
}
} else {
$subscriberBox.css('color', 'red');
}
});
}
function actionhomeFootChange() {
var $vote = $('.vote'),
$feedBackPage = $('#feed-back-page'),
count = $vote.children('li').length;
// 意见反馈
$feedBackPage.on('click', 'span', function() {
var $this = $(this);
if ($this.hasClass('cur')) {
return;
}
$this.siblings('.cur').removeClass('cur');
$this.addClass('cur');
$vote.children().not('.hide').addClass('hide')
.end()
.eq($this.index()).removeClass('hide');
});
$vote.on('click', '.feed-back-btn', function() {
var $this = $(this),
$li = $this.closest('li'),
index = $li.index(),
_solution = [];
var _answer = $li.find('.feedback-answer').val(),
_feedback = $li.find('.feedback-id').val(),
_question = $li.find('.question-id').val();
$li.find(':checked').each(function() {
_solution.push($(this).val());
});
$.ajax({
url: 'http://new.yohobuy.com/common/suggestfeedback',
dataType: 'jsonp',
data: {
feedback_id: _feedback || 0,
question_id: _question || 0,
answer: _answer || '',
solution: _solution.join(',')
},
success: function(data) {
var next = index + 1;
if (~~data.data.result === 1) {
if (index === count - 1) {
alert('感谢您的参与!'); // eslint-disable-line
return;
}
$li.addClass('hide');
$vote.children(':eq(' + (index + 1) + ')').removeClass('hide');
$feedBackPage.children('.cur').removeClass('cur');
$feedBackPage.children(':eq(' + next + ')').addClass('cur');
}
}
});
});
}
function rePosReturn() {
if ($(window).height() > $(document).height()) {
$returnTop.addClass('hide');
}
// 只在窗口高度大于文档高度的时候,隐藏返回顶部
// else {
// $returnTop.removeClass('hide');
// }
}
// 返回顶部
$returnTop.click(function() {
$('html,body').animate({
scrollTop: 0
}, 500);
});
$(window).scroll(function() {
if ($(window).scrollTop() === 0) {
$returnTop.addClass('hide');
} else {
$returnTop.removeClass('hide');
}
});
// 如果初始是隐藏的,监听图片加载,重新确定return-top的高度
if ($returnTop.hasClass('hide')) {
$('img').load(rePosReturn);
}
// 初始化
actionSubscription();
actionhomeFootChange();
// 暴露给有可能通AJAX改变内容的页面去用
window.rePosReturnTop = rePosReturn;
... ...
... ... @@ -3,10 +3,8 @@
* @author: yyq<yanqing.yang@yoho.cn>
* @date: 2016/5/9
*/
/* eslint-disable */
var $ = require('yoho-jquery');
// handlebars = require('yoho.handlebars'),
// json2 = require('json2');
var $ = require('yoho-jquery'),
handlebars = require('yoho-handlebars');
var $tool = $('.tool-wrapper'),
$yohoGroup = $tool.find('.yoho-group'),
... ... @@ -21,29 +19,25 @@ var $head = $('.head-wrapper'),
var $subNav = $('.sub-nav-list .contain-third');
var apiDomain = $('#api-domain').val(), // 获取登陆状态的地址
apiBanner = 'http://new.yohobuy.com/common/getbanner',
thirdLineNum = 9,
var thirdLineNum = 9,
delayer,
centerFn,
loginFn,
cartFn;
$('#api-domain').remove(); // 删除地址信息
// handlebars模板
// centerFn = handlebars.compile($('#simple-account-info-tpl').html());
// loginFn = handlebars.compile($('#header-login-info-tpl').html());
// cartFn = handlebars.compile($('#mini-cart-tpl').html());
centerFn = handlebars.compile($('#simple-account-info-tpl').html());
loginFn = handlebars.compile($('#header-login-info-tpl').html());
cartFn = handlebars.compile($('#mini-cart-tpl').html());
// handlebars helper
// handlebars.registerHelper('notzero', function(v1, options) {
// if (v1 !== '0') {
// return options.fn(this);
// } else {
// return options.inverse(this);
// }
// });
handlebars.registerHelper('notzero', function(v1, options) {
if (v1 !== '0') {
return options.fn(this);
} else {
return options.inverse(this);
}
});
// 格式化三级菜单
function formatThirdMenu() {
... ... @@ -91,7 +85,7 @@ function syncLoginInfo() {
method: 'open.passport.get'
};
$.getJSON(apiDomain + '/?callback=?', param, function(jsonData) {
$.getJSON('http://www.yohobuy.com/common/passport/?callback=?', param, function(jsonData) {
if (jsonData && jsonData.data && jsonData.data.result !== -1) {
updateLoginInfo(jsonData.data.data);
} else {
... ... @@ -110,7 +104,7 @@ function searchSuggest(key) {
query: key
};
$.getJSON('http://search.yohobuy.com/api/suggest/?callback=?', param, function(jsonData) {
$.getJSON('http://search.yohobuy.com/api/suggest?callback=?', param, function(jsonData) {
if (jsonData.code === 200) {
if (jsonData.data && jsonData.data.length) {
$searchSug.html(jsonData.data).show();
... ... @@ -123,72 +117,72 @@ function searchSuggest(key) {
// 同步mini购物车数据
function syncCratInfo(strG) {
// var info, total;
//
// if (strG) {
// window.setCookie('_g', strG, {
// path: '/',
// domain: '.yohobuy.com'
// });
// }
// if (window.cookie('_g')) {
// info = json2.parse(window.cookie('_g'));
// total = parseInt(info._nac) + parseInt(info._ac);
// total = total > 0 ? total : 0;
// $goCart.data({
// key: info._k,
// num: total
// });
// $goodsNum.text(total);
// }
var info, total;
if (strG) {
window.setCookie('_g', strG, {
path: '/',
domain: '.yohobuy.com'
});
}
if (window.cookie('_g')) {
info = $.parseJSON(window.cookie('_g'));
total = parseInt(info._nac, 10) + parseInt(info._ac, 10);
total = total > 0 ? total : 0;
$goCart.data({
key: info._k,
num: total
});
$goodsNum.text(total);
}
}
function loadCartDetail(key) {
// var param = {
// return_type: 'jsonp',
// method: 'open.Shoppingcart.getCartData',
// shopping_key: key
// };
//
// $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) {
// var totalGoods, data;
//
// if (jsonData.code === 200) {
// data = jsonData.data;
// totalGoods = $.merge(data.main_goods, data.advance_goods);
// totalGoods = $.merge(totalGoods, data.outlet_goods);
// totalGoods = $.merge(totalGoods, data.gift_goods);
// totalGoods = $.merge(totalGoods, data.need_pay_gifts);
// if (totalGoods && totalGoods.length) {
// data.totalGoods = totalGoods;
// $miniCart.html(cartFn({
// carData: data
// }));
// } else {
// $miniCart.html('<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>');
// }
// }
// });
var param = {
return_type: 'jsonp',
method: 'open.Shoppingcart.getCartData',
shopping_key: key
};
$.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) {
var totalGoods, data;
if (jsonData.code === 200) {
data = jsonData.data;
totalGoods = $.merge(data.main_goods, data.advance_goods);
totalGoods = $.merge(totalGoods, data.outlet_goods);
totalGoods = $.merge(totalGoods, data.gift_goods);
totalGoods = $.merge(totalGoods, data.need_pay_gifts);
if (totalGoods && totalGoods.length) {
data.totalGoods = totalGoods;
$miniCart.html(cartFn({
carData: data
}));
} else {
$miniCart.html('<div class="empty-cart"><h3>您的购物车暂无商品</h3></div>');
}
}
});
}
function delCartGoods(data, callback) {
// var param = {
// return_type: 'jsonp',
// method: 'open.Shoppingcart.delone',
// shopping_key: data.key,
// id: data.id,
// isreduce: data.isreduce
// };
//
// $.getJSON(apiDomain + '/?callback=?', param, function(jsonData) {
// var strG = '';
//
// if (jsonData.code === 200) {
// callback();
// strG = '{"_k":"' + data.key + '","_nac":' + jsonData.data.total_goods_num + ',"_ac":0,"_r":0}';
// syncCratInfo(strG);
// }
// });
var param = {
return_type: 'jsonp',
method: 'open.Shoppingcart.delone',
shopping_key: data.key,
id: data.id,
isreduce: data.isreduce
};
$.getJSON('http://www.yohobuy.com/common/shoppingCart/?callback=?', param, function(jsonData) {
var strG = '';
if (jsonData.code === 200) {
strG = '{"_k":"' + data.key + '","_nac":' + jsonData.data.total_goods_num + ',"_ac":0,"_r":0}';
syncCratInfo(strG);
return callback();
}
});
}
syncLoginInfo();
... ... @@ -240,9 +234,10 @@ $searchForm.on('keyup', '.search-key', function(e) {
$(this).val(val);
searchSuggest(val);
}
// http://search.yohobuy.com/api/suggest
// searchSuggest
}).on('blur', '.search-key', function() {
setTimeout(function() {
$searchSug.hide();
}, 200);
});
$goCart.hover(function() {
... ... @@ -265,7 +260,7 @@ $goCart.hover(function() {
$goCart.removeClass('on-hover');
});
$goCart.on('click', '.cart-goods-del', function(e) {
$goCart.on('click', '.cart-goods-del', function() {
var $dom = $(this),
data = $dom.data(),
callback;
... ... @@ -297,14 +292,14 @@ $subNav.on({
param.width = 174;
param.height = 155;
param._ = new Date();
// $.getJSON(apiBanner + '/?callback=?', param, function(JsonData) {
// if (JsonData.code === 200) {
// $show.addClass('show');
// $show.find('img').attr('src', JsonData.data.src);
// $show.find('a').attr('href', JsonData.data.url);
// $show.find('.title').text(JsonData.data.title);
// }
// });
$.getJSON('http://new.yohobuy.com/common/getbanner?callback=?', param, function(JsonData) {
if (JsonData.code === 200) {
$show.addClass('show');
$show.find('img').attr('src', JsonData.data.src);
$show.find('a').attr('href', JsonData.data.url);
$show.find('.title').text(JsonData.data.title);
}
});
},
mouseleave: function() {
var $thirdNav = $(this).children('.third-nav-wrapper');
... ... @@ -315,6 +310,3 @@ $subNav.on({
$thirdNav.hide();
}
});
/* eslint-ensable */
... ...
require('../header');
require('../common');
... ...
... ... @@ -48,6 +48,7 @@
span {
display: inline-block;
vertical-align: middle;
line-height: 30px;
}
.hi {
... ... @@ -343,7 +344,7 @@
border: none;
background: #fff;
box-sizing: border-box;
padding: 7px 0 7px 10px;
padding: 7px 0 9px 10px;
}
.search-btn {
... ... @@ -415,7 +416,7 @@
top: 30px;
right: -14px;
width: 378px;
background: #f8f8f8 reslove('layout/empty_car.png') no-repeat 106px 132px;
background: #f8f8f8 resolve('layout/empty_car.png') no-repeat 106px 132px;
z-index: 1000;
display: none;
... ...