...
|
...
|
@@ -990,7 +990,11 @@ var $loading, |
|
|
|
|
|
// 初始化
|
|
|
function init($container) {
|
|
|
var html = '<div class="loading-mask hide"><div class="loading"></div></div>';
|
|
|
var html = '<div class="loading-mask hide">' +
|
|
|
'<div class="loading">' +
|
|
|
'<div></div><div></div><div></div>' +
|
|
|
'</div>' +
|
|
|
'</div>';
|
|
|
|
|
|
hasInit = true;
|
|
|
if ($container === undefined) {
|
...
|
...
|
@@ -1970,6 +1974,7 @@ var $icon = $('.search-icon'); |
|
|
var $form = $('#search-form');
|
|
|
|
|
|
var $history = $('.history');
|
|
|
var $historySearch = $('.history-search');
|
|
|
|
|
|
var $clearHistory = $('#clear-history');
|
|
|
|
...
|
...
|
@@ -1984,6 +1989,8 @@ chHammer.on('tap', function() { |
|
|
localStorage.removeItem('historys');
|
|
|
|
|
|
$history.html('');
|
|
|
$historySearch.hide();
|
|
|
$clearHistory.hide();
|
|
|
|
|
|
window.rePosFooter();
|
|
|
});
|
...
|
...
|
@@ -2033,7 +2040,7 @@ $('#search').on('touchend', function() { |
|
|
|
|
|
$history.html(html);
|
|
|
$clearHistory.removeClass('hide');
|
|
|
|
|
|
$historySearch.removeClass('hide');
|
|
|
window.rePosFooter();
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -2206,24 +2213,12 @@ var $searchBox = $('.search-box'), |
|
|
$box = $('.box'),
|
|
|
$indexSearch = $('.index-search'),
|
|
|
$indexLogo = $('.index-logo'),
|
|
|
$channelLink = $('.index-channel a'),
|
|
|
$win = $(window),
|
|
|
$doc = $(document),
|
|
|
$appFloatLayer = $('#float-layer-app');
|
|
|
$channelLink = $('.index-channel a');
|
|
|
|
|
|
var $search = $searchBox.children('input[type="text"]'),
|
|
|
$cancelSearch = $box.children('.no-search'),
|
|
|
$searchIcon = $searchBox.children('.search-icon');
|
|
|
|
|
|
// variables for calculate the app download layer position
|
|
|
var layerInit = false,
|
|
|
windowViewHeight = 0,
|
|
|
layerContentHeight = $appFloatLayer.height(),
|
|
|
layerPaddingTop = parseInt($appFloatLayer.css('padding-top')),
|
|
|
layerPaddingBottom = parseInt($appFloatLayer.css('padding-bottom')),
|
|
|
layerHeight = layerContentHeight + layerPaddingTop + layerPaddingBottom,
|
|
|
layerNewPos;
|
|
|
|
|
|
require("js/common");
|
|
|
|
|
|
$search.on('focus', function() {
|
...
|
...
|
@@ -2255,6 +2250,15 @@ $searchBox.children('.search-icon').on('touchstart', function() { |
|
|
$indexSearch.submit();
|
|
|
});
|
|
|
|
|
|
$searchBox.keyup(function(e) {
|
|
|
if (e.keyCode === 13) {
|
|
|
if (security.hasDangerInput()) {
|
|
|
return false;
|
|
|
}
|
|
|
$indexSearch.submit();
|
|
|
}
|
|
|
});
|
|
|
|
|
|
$('.index-channel img').on('load error', function() {
|
|
|
window.rePosFooter && window.rePosFooter();
|
|
|
});
|
...
|
...
|
@@ -2278,43 +2282,6 @@ $channelLink.on('touchstart', function() { |
|
|
});
|
|
|
});
|
|
|
|
|
|
|
|
|
function updateLayerPosition() {
|
|
|
var winHeight = window.innerHeight,
|
|
|
bodyHeight = $doc.height(),
|
|
|
scrollTopPosition = $win.scrollTop();
|
|
|
|
|
|
if (layerInit) {
|
|
|
|
|
|
//keyboard is shown
|
|
|
if (windowViewHeight - winHeight > 200) {
|
|
|
if (scrollTopPosition + windowViewHeight + layerHeight >= bodyHeight) {
|
|
|
layerNewPos = 0;
|
|
|
} else {
|
|
|
layerNewPos = bodyHeight - windowViewHeight - scrollTopPosition - layerHeight;
|
|
|
}
|
|
|
} else {
|
|
|
layerNewPos = bodyHeight - winHeight - scrollTopPosition;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
windowViewHeight = winHeight;
|
|
|
layerNewPos = bodyHeight - winHeight - scrollTopPosition + layerHeight;
|
|
|
layerInit = true;
|
|
|
}
|
|
|
|
|
|
$appFloatLayer.css({
|
|
|
position: 'relative',
|
|
|
bottom: layerNewPos + 'px'
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$(window).scroll(function() {
|
|
|
window.requestAnimationFrame(updateLayerPosition);
|
|
|
});
|
|
|
|
|
|
$doc.on('ready', updateLayerPosition);
|
|
|
|
|
|
});
|
|
|
define("js/passport/entry", ["jquery"], function(require, exports, module){
|
|
|
/**
|
...
|
...
|
@@ -3299,7 +3266,7 @@ var winH = $(window).height(), |
|
|
noResult = '<p class="no-result">未找到相关搜索结果</p>';
|
|
|
|
|
|
//默认筛选条件
|
|
|
var defaultOpt = require("js/product/extract-url");
|
|
|
var defaultOpt = require("js/product/query-param");
|
|
|
|
|
|
var storeOpt = $.extend({}, defaultOpt); //存储默认筛选条件以便重置
|
|
|
|
...
|
...
|
@@ -3844,49 +3811,21 @@ exports.hideFilter = hideFilter; |
|
|
exports.resetFilter = resetFilter;
|
|
|
|
|
|
});
|
|
|
define("js/product/extract-url", [], function(require, exports, module){
|
|
|
define("js/product/query-param", ["jquery"], function(require, exports, module){
|
|
|
/**
|
|
|
* 提取URL中的参数
|
|
|
* 提取查询参数
|
|
|
* @author: xuqi<qi.xu@yoho.cn>
|
|
|
* @date: 2015/11/19
|
|
|
*/
|
|
|
|
|
|
var opt = {};
|
|
|
|
|
|
var paramStr = window.location.search.split('?')[1];
|
|
|
|
|
|
var keyVal = paramStr ? paramStr.split('&') : [];
|
|
|
|
|
|
var i, key, val;
|
|
|
|
|
|
for (i = keyVal.length; i > 0; i--) {
|
|
|
key = keyVal[i - 1].split('=');
|
|
|
|
|
|
val = key[1];
|
|
|
key = key[0];
|
|
|
var $ = require("jquery"),
|
|
|
opt = {};
|
|
|
|
|
|
//初始化默认参数
|
|
|
opt[key] = val;
|
|
|
$('.query-param').each(function() {
|
|
|
var $this = $(this);
|
|
|
|
|
|
//discount = p_d,同时需要两个参数
|
|
|
if (key === 'discount' || key === 'p_d') {
|
|
|
opt.discount = val;
|
|
|
opt.p_d = val;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (typeof opt.gender === 'undefined') {
|
|
|
switch (window.cookie('_Channel')) {
|
|
|
case 'boys':
|
|
|
opt.gender = '1,3';
|
|
|
break;
|
|
|
case 'girls':
|
|
|
opt.gender = '2,3';
|
|
|
break;
|
|
|
default:
|
|
|
opt.gender = '1,2,3';
|
|
|
}
|
|
|
}
|
|
|
opt[$this.data('attr')] = $this.val();
|
|
|
});
|
|
|
|
|
|
module.exports = opt;
|
|
|
});
|
...
|
...
|
@@ -3938,7 +3877,7 @@ var winH = $(window).height(), |
|
|
noResult = '<p class="no-result">未找到相关搜索结果</p>';
|
|
|
|
|
|
//默认筛选条件
|
|
|
var defaultOpt = require("js/product/extract-url");
|
|
|
var defaultOpt = require("js/product/query-param");
|
|
|
|
|
|
var $listNav = $('#list-nav'),
|
|
|
|
...
|
...
|
@@ -4324,7 +4263,7 @@ var $input = $('#search-input input'), |
|
|
$clear = $('#search-input .clear-input');
|
|
|
|
|
|
//默认筛选条件
|
|
|
var defaultOpt = require("js/product/extract-url");
|
|
|
var defaultOpt = require("js/product/query-param");
|
|
|
|
|
|
var $listNav = $('#list-nav'),
|
|
|
|
...
|
...
|
@@ -4771,10 +4710,8 @@ var goodsSwiper, |
|
|
var goodsDiscountEl = document.getElementById('goodsDiscount'),
|
|
|
goodsDiscountHammer = goodsDiscountEl && new Hammer(goodsDiscountEl);
|
|
|
|
|
|
var $cart = $('.cart-bar'),
|
|
|
$goodsSubtitle = $('.goodsSubtitle'),
|
|
|
divH,
|
|
|
$goodsSubtitleSpan;
|
|
|
var $cart = $('.cart-bar');
|
|
|
var UA = navigator.userAgent.toLowerCase().toString();
|
|
|
|
|
|
require("js/product/detail/desc");
|
|
|
require("js/product/detail/comments-consults");
|
...
|
...
|
@@ -4811,13 +4748,13 @@ goodsSwiper = new Swiper('.banner-swiper', { |
|
|
|
|
|
|
|
|
//初始化goods-discount
|
|
|
if (0 === $('.goodsDiscount .discount-folder').children().length) {
|
|
|
if (0 === $discountFolder.children().length) {
|
|
|
$discountFolder.css('display', 'none');
|
|
|
$discountArrow.html('');
|
|
|
}
|
|
|
|
|
|
//goods-discount下拉按钮点击事件
|
|
|
if (goodsDiscountHammer) {
|
|
|
if (goodsDiscountHammer && $discountFolder.children().length > 0) {
|
|
|
goodsDiscountHammer.on('tap', function(e) {
|
|
|
if ($discountFolder.is(':hidden')) {
|
|
|
$discountArrow.removeClass('icon-down').addClass('icon-up').html('');
|
...
|
...
|
@@ -4826,7 +4763,6 @@ if (goodsDiscountHammer) { |
|
|
$discountArrow.removeClass('icon-up').addClass('icon-down').html('');
|
|
|
$discountFolder.slideUp();
|
|
|
}
|
|
|
return false;
|
|
|
});
|
|
|
}
|
|
|
|
...
|
...
|
@@ -4841,13 +4777,8 @@ $.ajax({ |
|
|
}
|
|
|
});
|
|
|
|
|
|
//限制goodsSubtitle为两行
|
|
|
if ($goodsSubtitle[0]) {
|
|
|
divH = $goodsSubtitle.height();
|
|
|
$goodsSubtitleSpan = $goodsSubtitle.find('span');
|
|
|
while ($goodsSubtitleSpan.outerHeight() > divH) {
|
|
|
$goodsSubtitleSpan.text($goodsSubtitleSpan.text().replace(/(\s)*([a-zA-Z0-9]+|\W)(\.\.\.)?$/, '...'));
|
|
|
}
|
|
|
if (UA.indexOf('mqqbrowser') > -1) {
|
|
|
$('.detail > div').removeClass('column').addClass('oldbox');
|
|
|
}
|
|
|
require("js/product/detail/like");
|
|
|
|
...
|
...
|
@@ -4908,6 +4839,8 @@ function search() { |
|
|
$productDesc = $('#productDesc');
|
|
|
$productDesc.append(data);
|
|
|
|
|
|
window.rePosFooter();
|
|
|
|
|
|
lazyLoad($productDesc.find('img.lazy'));
|
|
|
|
|
|
//尺码信息左右滑动
|
...
|
...
|
@@ -4960,17 +4893,14 @@ var $ = require("jquery"), |
|
|
|
|
|
var commentsNum,consultsNum;
|
|
|
|
|
|
var consultFooterEle = document.getElementById('consult-content-footer'),
|
|
|
var consultFooterEle = $('.consult-content-footer')[0],
|
|
|
consultFooterHammer = consultFooterEle && new Hammer(consultFooterEle),
|
|
|
|
|
|
navtabEle = document.getElementById('nav-tab'),
|
|
|
navtabHammer = navtabEle && new Hammer(navtabEle),
|
|
|
|
|
|
gotoConsultEle = document.getElementById('goto-consult'),
|
|
|
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle),
|
|
|
|
|
|
$gotoConsult = $('#goto-consult');
|
|
|
|
|
|
gotoConsultHammer = gotoConsultEle && new Hammer(gotoConsultEle);
|
|
|
|
|
|
|
|
|
(function() {
|
...
|
...
|
@@ -5022,33 +4952,21 @@ if (navtabHammer) { |
|
|
|
|
|
if (consultFooterHammer) {
|
|
|
consultFooterHammer.on('tap', function() {
|
|
|
location.href = $(consultFooterEle).find('a').attr('href');
|
|
|
location.href = $(consultFooterEle).data('href');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
if (gotoConsultHammer) {
|
|
|
gotoConsultHammer.on('tap', function() {
|
|
|
location.href = $(gotoConsultEle).find('a').attr('href');
|
|
|
location.href = $(gotoConsultEle).data('href');
|
|
|
});
|
|
|
}
|
|
|
|
|
|
function fixConsultBar() {
|
|
|
if ($(window).scrollTop() > $('#yoho-header').outerHeight()) {
|
|
|
$gotoConsult.css('position', 'fixed');
|
|
|
$gotoConsult.css('top', '0');
|
|
|
} else {
|
|
|
$gotoConsult.css('position', 'static');
|
|
|
}
|
|
|
//咨询页面固定header
|
|
|
if ($('.goods-consults-page').length > 0) {
|
|
|
$('#yoho-header').css('position', 'fixed').css('top', '0');
|
|
|
}
|
|
|
|
|
|
//滚动时顶部固定 我要咨询
|
|
|
function scrollHandler() {
|
|
|
fixConsultBar();
|
|
|
}
|
|
|
|
|
|
$(window).scroll(function() {
|
|
|
window.requestAnimationFrame(scrollHandler);
|
|
|
});
|
|
|
|
|
|
});
|
|
|
define("js/product/recommend-for-you-product-desc", ["swiper","jquery","index"], function(require, exports, module){
|
...
|
...
|
@@ -5078,6 +4996,9 @@ if (preferenceUrl) { |
|
|
watchSlidesVisibility: true
|
|
|
});
|
|
|
}
|
|
|
|
|
|
window.rePosFooter();
|
|
|
|
|
|
}).fail(function() {
|
|
|
$recommendForYou.hide();
|
|
|
});
|
...
|
...
|
@@ -5450,13 +5371,17 @@ function getOrders(option) { |
|
|
|
|
|
if (opt.page === 1) {
|
|
|
$curContainer.html(data);
|
|
|
lazyLoad($curContainer.find('.lazy'));
|
|
|
lazyLoad($curContainer.find('.lazy'), {
|
|
|
try_again_css: 'order-failure'
|
|
|
});
|
|
|
} else {
|
|
|
num = $curContainer.children('.order').length;
|
|
|
$curContainer.append(data);
|
|
|
|
|
|
//lazyload
|
|
|
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
|
|
|
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'), {
|
|
|
try_again_css: 'order-failure'
|
|
|
});
|
|
|
}
|
|
|
|
|
|
window.rePosFooter(); //重新计算底部位置
|
...
|
...
|
@@ -5470,7 +5395,9 @@ function getOrders(option) { |
|
|
});
|
|
|
}
|
|
|
|
|
|
lazyLoad();
|
|
|
lazyLoad({
|
|
|
try_again_css: 'order-failure'
|
|
|
});
|
|
|
|
|
|
//初始化导航
|
|
|
(function() {
|
...
|
...
|
@@ -5706,7 +5633,9 @@ var orderId = $('#order-detail').data('id'); |
|
|
|
|
|
var optHammer;
|
|
|
|
|
|
lazyLoad();
|
|
|
lazyLoad({
|
|
|
try_again_css: 'order-failure'
|
|
|
});
|
|
|
|
|
|
//订单删除
|
|
|
optHammer = new Hammer(document.getElementsByClassName('opt')[0]);
|
...
|
...
|
@@ -5755,7 +5684,6 @@ var diaLog = require("js/me/dialog"); |
|
|
|
|
|
var $navLi = $('#fav-tab > li'),
|
|
|
$favContainer = $('.fav-content > .fav-type'),
|
|
|
$swiperList = '',
|
|
|
swiperObj = {},
|
|
|
favTabHammer,
|
|
|
favContentHammer,
|
...
|
...
|
@@ -5780,22 +5708,30 @@ function showFavTab(index) { |
|
|
}
|
|
|
|
|
|
//初始化swiper
|
|
|
function initSwiper() {
|
|
|
function initSwiper(data) {
|
|
|
var i,
|
|
|
id;
|
|
|
idStrReg = /container-(\d+)['"]{1}/gi,
|
|
|
idReg = /\d+/,
|
|
|
idArr = data.match(idStrReg),
|
|
|
idArrLen = idArr.length,
|
|
|
containerId;
|
|
|
|
|
|
$swiperList = $('.swiper-container');
|
|
|
for (i = 0; i < $swiperList.length; i++) {
|
|
|
id = $swiperList.eq(i).attr('data-id');
|
|
|
//$swiperList = $('.swiper-container');
|
|
|
for (i = 0; i < idArrLen; i++) {
|
|
|
|
|
|
/*id = $swiperList.eq(i).attr('data-id');
|
|
|
|
|
|
if (!!swiperObj[id]) {
|
|
|
swiperObj[id].destroy(true, true);
|
|
|
}
|
|
|
swiperObj[id] = new Swiper('#swiper-container-' + id, {
|
|
|
}*/
|
|
|
|
|
|
containerId = idArr[i].match(idReg)[0];
|
|
|
|
|
|
swiperObj[containerId] = new Swiper('#swiper-container-' + containerId, {
|
|
|
slidesPerView: 'auto',
|
|
|
grabCursor: true,
|
|
|
slideElement: 'li',
|
|
|
wrapperClass: 'swiper-wrapper-' + id,
|
|
|
wrapperClass: 'swiper-wrapper-' + containerId,
|
|
|
lazyLoading: true,
|
|
|
watchSlidesVisibility: true
|
|
|
});
|
...
|
...
|
@@ -5836,7 +5772,7 @@ function loadData($parent, url, page) { |
|
|
$parent.append(data);
|
|
|
$parent.closest('.fav-type').find('.fav-content-loading').remove();
|
|
|
if (url === 'favBrand') {
|
|
|
initSwiper();//如果是收藏品牌需要初始化swiper
|
|
|
initSwiper(data);//如果是收藏品牌需要初始化swiper
|
|
|
|
|
|
brandLockId = false;//请求成功后解锁品牌收藏page++
|
|
|
} else {
|
...
|
...
|
@@ -6026,7 +5962,7 @@ $('#upload-img').uploadifive({ |
|
|
fileType: 'image*/*',
|
|
|
uploadScript: '/home/suggestimgUpload',
|
|
|
fileObjName: 'fileData',
|
|
|
fileSizeLimit: 1024,
|
|
|
fileSizeLimit: 300,
|
|
|
height: '100%',
|
|
|
width: '100%',
|
|
|
multi: false,
|
...
|
...
|
@@ -7700,7 +7636,7 @@ function callpay(orderCode) { |
|
|
function isWXOpen() {
|
|
|
var ua = window.navigator.userAgent.toLowerCase();
|
|
|
|
|
|
if (ua.match(/MicroMessenger/i) === 'micromessenger') {
|
|
|
if (ua.indexOf('micromessenger') > 0) {
|
|
|
return true;
|
|
|
} else {
|
|
|
return false;
|
...
|
...
|
|