Authored by 郭成尧

'shop-fav'

... ... @@ -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();
... ... @@ -274,9 +274,9 @@ 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');
... ... @@ -374,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,
... ... @@ -466,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();
... ... @@ -479,7 +479,7 @@ document.addEventListener('touchmove', function (e) {
// window ready 后重新refresh iscroll
$(window).ready(function () {
$(window).ready(function() {
// myScroll && myScroll.refresh();
imgH = $('#nav-top').outerHeight();
nav1H = $('#nav').outerHeight();
... ... @@ -495,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();
... ... @@ -510,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();
... ... @@ -655,7 +655,7 @@ function search(opt) {
type: 'GET',
url: opt.url ? opt.url : '',
data: setting,
success: function (data) {
success: function(data) {
var $container,
num;
... ... @@ -705,7 +705,7 @@ function search(opt) {
bindGoodThumbClick();
},
error: function () {
error: function() {
tip.show('网络断开连接了~');
searching = false;
loading.hideLoadingMask();
... ... @@ -714,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,
... ... @@ -861,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');
... ... @@ -876,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();
... ... @@ -894,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');
});
... ... @@ -910,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) {
... ... @@ -945,7 +945,7 @@ $collect.on('touchstart', function () {
xhrFields: {
withCredentials: true
},
success: function (data) {
success: function(data) {
var url = '';
if (data.code === 200) {
... ... @@ -966,13 +966,13 @@ $collect.on('touchstart', function () {
$('#jump-login').click();
}
setTimeout(function () {
setTimeout(function() {
myScroll && myScroll.refresh();
scH = $('#scroller').outerHeight();
}, 500);
searching = false;
},
error: function () {
error: function() {
tip.show('网络断开连接了~');
searching = false;
}
... ...