...
|
...
|
@@ -51,79 +51,83 @@ var defaultOpt = require('../common/query-param'); |
|
|
var param = location.search;
|
|
|
var isApp = param.indexOf('app_version') > -1 || param.indexOf('appVersion') > -1;
|
|
|
|
|
|
if (isApp) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/index/shopAppCookie',
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/index/shopFav',
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
data: {
|
|
|
shopId: $('.shopid').val(),
|
|
|
},
|
|
|
success: function(data) {
|
|
|
if (data.collect) {
|
|
|
$collect.attr('class', 'already-collect');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
//不阻塞字体文件加载
|
|
|
setTimeout(function() {
|
|
|
if (isApp) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/index/shopAppCookie',
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
if ($('.popularity-title').data('skns')) {
|
|
|
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/new/shop/hotlist',
|
|
|
url: '/product/index/shopFav',
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
data: {
|
|
|
skns: $('.popularity-title').data('skns'),
|
|
|
shopId: $('.shopid').val(),
|
|
|
},
|
|
|
success: function(data) {
|
|
|
$('.product-warp>.goods-container').html(data)
|
|
|
if (data.collect) {
|
|
|
$collect.attr('class', 'already-collect');
|
|
|
}
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/search/filter',
|
|
|
data: {
|
|
|
shop_id: $('.shopid').val(),
|
|
|
type: 'default',
|
|
|
order: '0',
|
|
|
channel: defaultOpt.channel
|
|
|
},
|
|
|
success: function(data) {
|
|
|
$goodsContainer.append(data);
|
|
|
|
|
|
// 初始化filter&注册filter回调
|
|
|
filter.initFilter({
|
|
|
fCbFn: search,
|
|
|
hCbFn: function() {
|
|
|
|
|
|
// 切换active状态到$pre上
|
|
|
$pre.addClass('active');
|
|
|
$pre.siblings('.filter').removeClass('active');
|
|
|
if ($('.popularity-title').data('skns')) {
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/new/shop/hotlist',
|
|
|
xhrFields: {
|
|
|
withCredentials: true
|
|
|
},
|
|
|
data: {
|
|
|
skns: $('.popularity-title').data('skns'),
|
|
|
},
|
|
|
success: function(data) {
|
|
|
$('.product-warp>.goods-container').html(data)
|
|
|
},
|
|
|
error: function() {
|
|
|
tip.show('网络断开连接了~');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '/product/search/filter',
|
|
|
data: {
|
|
|
shop_id: $('.shopid').val(),
|
|
|
type: 'default',
|
|
|
order: '0',
|
|
|
channel: defaultOpt.channel
|
|
|
},
|
|
|
success: function(data) {
|
|
|
$goodsContainer.append(data);
|
|
|
|
|
|
// 初始化filter&注册filter回调
|
|
|
filter.initFilter({
|
|
|
fCbFn: search,
|
|
|
hCbFn: function() {
|
|
|
|
|
|
// 切换active状态到$pre上
|
|
|
$pre.addClass('active');
|
|
|
$pre.siblings('.filter').removeClass('active');
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
});
|
|
|
}, 0)
|
|
|
|
|
|
}());
|
|
|
|
|
|
|
...
|
...
|
|