...
|
...
|
@@ -43,7 +43,7 @@ var winH = $(window).height(), |
|
|
require('../../common');
|
|
|
|
|
|
// pagecache判断app设置cookie,判断是否收藏
|
|
|
(function() {
|
|
|
(function () {
|
|
|
var param = location.search;
|
|
|
var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
|
|
|
|
...
|
...
|
@@ -51,7 +51,7 @@ require('../../common'); |
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/index/shopAppCookie',
|
|
|
error: function() {
|
|
|
error: function () {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -63,12 +63,12 @@ require('../../common'); |
|
|
data: {
|
|
|
shopId: $('.shopid').val(),
|
|
|
},
|
|
|
success: function(data) {
|
|
|
success: function (data) {
|
|
|
if (data.collect) {
|
|
|
$collect.attr('class', 'already-collect');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
error: function () {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -191,14 +191,14 @@ function getPageGoods(info) { |
|
|
type: 'GET',
|
|
|
url: info.url,
|
|
|
data: info.data,
|
|
|
success: function(data) {
|
|
|
success: function (data) {
|
|
|
if (data === ' ') {
|
|
|
nav.end = true;
|
|
|
}
|
|
|
|
|
|
info.callBack(data);
|
|
|
},
|
|
|
error: function() {
|
|
|
error: function () {
|
|
|
tip.show('网络断开连接了~');
|
|
|
searching = false;
|
|
|
}
|
...
|
...
|
@@ -228,7 +228,7 @@ function newData(callback) { |
|
|
|
|
|
getParam(req);
|
|
|
|
|
|
req.callBack = function(data) {
|
|
|
req.callBack = function (data) {
|
|
|
$('#new-arrival').append(data);
|
|
|
navInfo.new.page++;
|
|
|
myScroll && myScroll.refresh();
|
...
|
...
|
@@ -253,7 +253,7 @@ function hotData(callback) { |
|
|
|
|
|
getParam(req);
|
|
|
|
|
|
req.callBack = function(data) {
|
|
|
req.callBack = function (data) {
|
|
|
$('#popularity').append(data);
|
|
|
navInfo.hot.page++;
|
|
|
myScroll && myScroll.refresh();
|
...
|
...
|
@@ -273,12 +273,10 @@ function tabChange(dom, index) { |
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 首页导航
|
|
|
(function(nav, posNav, main) {
|
|
|
(function (nav, posNav, main) {
|
|
|
|
|
|
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function() {
|
|
|
$(nav + ' li, ' + posNav + ' li').not('li.all-goods').on('touchstart', function () {
|
|
|
|
|
|
var index = $(this).index(),
|
|
|
activeTab = $(this).attr('tab');
|
...
|
...
|
@@ -376,7 +374,7 @@ function scrollHandler() { |
|
|
}
|
|
|
|
|
|
if (sTop + winH * 2 > scH) {
|
|
|
scrollCall = function() {
|
|
|
scrollCall = function () {
|
|
|
var translate = 'translate3d(0, ' + (-scH) + 'px, 0)';
|
|
|
$nav1.css({
|
|
|
transform: translate,
|
...
|
...
|
@@ -468,7 +466,7 @@ function scrollHandler() { |
|
|
$('#scroller').trigger('scroll');
|
|
|
}
|
|
|
|
|
|
document.addEventListener('touchmove', function(e) {
|
|
|
document.addEventListener('touchmove', function (e) {
|
|
|
// sub classify不阻止默认事件
|
|
|
if ($(e.target).closest('.sub-classify').length === 0) {
|
|
|
e.preventDefault();
|
...
|
...
|
@@ -476,12 +474,12 @@ document.addEventListener('touchmove', function(e) { |
|
|
}, false);
|
|
|
|
|
|
/* if (!isIphone) {
|
|
|
return;
|
|
|
}*/
|
|
|
return;
|
|
|
}*/
|
|
|
|
|
|
|
|
|
// window ready 后重新refresh iscroll
|
|
|
$(window).ready(function() {
|
|
|
$(window).ready(function () {
|
|
|
// myScroll && myScroll.refresh();
|
|
|
imgH = $('#nav-top').outerHeight();
|
|
|
nav1H = $('#nav').outerHeight();
|
...
|
...
|
@@ -497,14 +495,14 @@ $(window).ready(function() { |
|
|
click: true
|
|
|
});
|
|
|
|
|
|
setTimeout(function() {
|
|
|
setTimeout(function () {
|
|
|
scH = $('#scroller').outerHeight();
|
|
|
}, 500);
|
|
|
|
|
|
|
|
|
myScroll.on('scroll', scrollHandler);
|
|
|
|
|
|
myScroll.on('scrollStart', function() {
|
|
|
myScroll.on('scrollStart', function () {
|
|
|
|
|
|
// stop auto play when scroll
|
|
|
bannerSwiper && bannerSwiper.stopAutoplay();
|
...
|
...
|
@@ -512,7 +510,7 @@ $(window).ready(function() { |
|
|
multiSwiper && multiSwiper.stopAutoplay();
|
|
|
});
|
|
|
|
|
|
myScroll.on('scrollEnd', function() {
|
|
|
myScroll.on('scrollEnd', function () {
|
|
|
|
|
|
// start auto play when scroll end
|
|
|
bannerSwiper && bannerSwiper.startAutoplay();
|
...
|
...
|
@@ -657,7 +655,7 @@ function search(opt) { |
|
|
type: 'GET',
|
|
|
url: opt.url ? opt.url : '',
|
|
|
data: setting,
|
|
|
success: function(data) {
|
|
|
success: function (data) {
|
|
|
var $container,
|
|
|
num;
|
|
|
|
...
|
...
|
@@ -707,7 +705,7 @@ function search(opt) { |
|
|
|
|
|
bindGoodThumbClick();
|
|
|
},
|
|
|
error: function() {
|
|
|
error: function () {
|
|
|
tip.show('网络断开连接了~');
|
|
|
searching = false;
|
|
|
loading.hideLoadingMask();
|
...
|
...
|
@@ -716,11 +714,11 @@ function search(opt) { |
|
|
}
|
|
|
|
|
|
|
|
|
$listNav.bind('contextmenu', function(e) {
|
|
|
$listNav.bind('contextmenu', function (e) {
|
|
|
return false;
|
|
|
});
|
|
|
|
|
|
$subNav.on('touchend touchcancel', function(e) {
|
|
|
$subNav.on('touchend touchcancel', function (e) {
|
|
|
var $this = $(e.target).closest('li'),
|
|
|
cname,
|
|
|
nav,
|
...
|
...
|
@@ -863,11 +861,11 @@ $subNav.on('touchend touchcancel', function(e) { |
|
|
});
|
|
|
|
|
|
filter.initFilter({
|
|
|
fCbFn: function(option) {
|
|
|
fCbFn: function (option) {
|
|
|
search(option);
|
|
|
myScroll && myScroll.enable();
|
|
|
},
|
|
|
hCbFn: function() {
|
|
|
hCbFn: function () {
|
|
|
|
|
|
// 切换active状态到$pre上
|
|
|
$pre.addClass('active');
|
...
|
...
|
@@ -878,17 +876,17 @@ filter.initFilter({ |
|
|
missStatus: true
|
|
|
});
|
|
|
|
|
|
$listNav.on('touchstart', 'li', function(e) {
|
|
|
$listNav.on('touchstart', 'li', function (e) {
|
|
|
$(this).addClass('bytouch');
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
}).on('touchend touchcancel', function () {
|
|
|
$listNav.find('li').removeClass('bytouch');
|
|
|
|
|
|
// myScroll && myScroll.refresh();
|
|
|
});
|
|
|
|
|
|
$nav2.on('touchstart', 'li', function(e) {
|
|
|
$nav2.on('touchstart', 'li', function (e) {
|
|
|
$(this).addClass('bytouch');
|
|
|
}).on('touchend touchcancel', function() {
|
|
|
}).on('touchend touchcancel', function () {
|
|
|
$nav2.find('li').removeClass('bytouch');
|
|
|
|
|
|
// myScroll && myScroll.refresh();
|
...
|
...
|
@@ -896,7 +894,7 @@ $nav2.on('touchstart', 'li', function(e) { |
|
|
|
|
|
// 底部导航点击
|
|
|
function fotterClick(group) {
|
|
|
$(group + ' li').on('touchstart', function() {
|
|
|
$(group + ' li').on('touchstart', function () {
|
|
|
$('.sub-group').addClass('hide');
|
|
|
$(this).find('.sub-group').removeClass('hide');
|
|
|
});
|
...
|
...
|
@@ -912,16 +910,16 @@ function stopPropagation(e) { |
|
|
}
|
|
|
}
|
|
|
|
|
|
$(document).bind('touchstart', function() {
|
|
|
$(document).bind('touchstart', function () {
|
|
|
$('.sub-group').addClass('hide');
|
|
|
});
|
|
|
|
|
|
$('.shop-foot-wrapper').bind('touchstart', function(e) {
|
|
|
$('.shop-foot-wrapper').bind('touchstart', function (e) {
|
|
|
stopPropagation(e);
|
|
|
});
|
|
|
|
|
|
// 店铺收藏 || 取消收藏
|
|
|
$collect.on('touchstart', function() {
|
|
|
$collect.on('touchstart', function () {
|
|
|
var opt;
|
|
|
|
|
|
if (searching) {
|
...
|
...
|
@@ -944,10 +942,10 @@ $collect.on('touchstart', function() { |
|
|
opt: opt,
|
|
|
type: 'shop'
|
|
|
},
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
success: function(data) {
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
success: function (data) {
|
|
|
var url = '';
|
|
|
|
|
|
if (data.code === 200) {
|
...
|
...
|
@@ -961,20 +959,20 @@ $collect.on('touchstart', function() { |
|
|
}
|
|
|
|
|
|
if (data.code === 400) {
|
|
|
url = data;
|
|
|
url = data.data;
|
|
|
if ($('#jump-login').length <= 0) {
|
|
|
$('body').append('<a href=\'' + url + '\'><span id="jump-login"><span></a>');
|
|
|
}
|
|
|
$('#jump-login').click();
|
|
|
}
|
|
|
|
|
|
setTimeout(function() {
|
|
|
setTimeout(function () {
|
|
|
myScroll && myScroll.refresh();
|
|
|
scH = $('#scroller').outerHeight();
|
|
|
}, 500);
|
|
|
searching = false;
|
|
|
},
|
|
|
error: function() {
|
|
|
error: function () {
|
|
|
tip.show('网络断开连接了~');
|
|
|
searching = false;
|
|
|
}
|
...
|
...
|
|