...
|
...
|
@@ -7,6 +7,7 @@ var $ = require('yoho-jquery'), |
|
|
Swiper = require('yoho-swiper'),
|
|
|
tip = require('../plugin/tip'),
|
|
|
loading = require('../plugin/loading'),
|
|
|
lazyload = require('yoho-jquery-lazyload'),
|
|
|
banner = require('../../template/resources/banner-top.hbs'),
|
|
|
tab = require('../../template/activity/single-day/tab.hbs'),
|
|
|
product = require('../../template/activity/single-day/product-list.hbs');
|
...
|
...
|
@@ -23,7 +24,7 @@ var getProductData = function(index, tabName) { |
|
|
loading.showLoadingMask();
|
|
|
$.ajax({
|
|
|
type: 'GET',
|
|
|
url: '',
|
|
|
url: '/activity/single-day/getProductData',
|
|
|
data: {
|
|
|
tab_name: tabName
|
|
|
},
|
...
|
...
|
@@ -32,6 +33,7 @@ var getProductData = function(index, tabName) { |
|
|
$('.product-tab').eq(index).append(product(data));
|
|
|
}
|
|
|
|
|
|
lazyload($('img.lazy'));
|
|
|
getFlag = false;
|
|
|
loading.hideLoadingMask();
|
|
|
},
|
...
|
...
|
@@ -52,9 +54,9 @@ var getInitData = function() { |
|
|
type: 'GET',
|
|
|
url: '/activity/single-day/getSingleData',
|
|
|
success: function(data) {
|
|
|
var i = 0;
|
|
|
var i = 0, $swiperTab;
|
|
|
|
|
|
data[1] = ['限定名额', '首发', '热卖', '明星单品'];
|
|
|
//data[1] = ['限定名额', '首发', '热卖', '明星单品'];
|
|
|
if (data[0]) {
|
|
|
$('.banner').append(banner(data[0][0]));
|
|
|
|
...
|
...
|
@@ -75,6 +77,8 @@ var getInitData = function() { |
|
|
if (data[1]) {
|
|
|
$('.swiper-tab').append(tab(data[1]));
|
|
|
|
|
|
$swiperTab = $('.swiper-tab li');
|
|
|
|
|
|
new Swiper('.swiper-tab', {
|
|
|
slidesPerView: 'auto'
|
|
|
});
|
...
|
...
|
@@ -84,19 +88,19 @@ var getInitData = function() { |
|
|
}
|
|
|
|
|
|
getProductData(hash, tabName(hash));
|
|
|
$swiperTab.eq(hash).addClass('active');
|
|
|
|
|
|
$('.swiper-tab li')
|
|
|
.eq(hash)
|
|
|
.addClass('active')
|
|
|
.on('click', function() {
|
|
|
var index = $(this).index();
|
|
|
|
|
|
if ($('.product-tab').eq(index).find('li').length > 0) {
|
|
|
return false;
|
|
|
} else {
|
|
|
getProductData(index, tabName(index));
|
|
|
}
|
|
|
});
|
|
|
$swiperTab.on('click', function() {
|
|
|
var index = $(this).index();
|
|
|
|
|
|
$swiperTab.removeClass('active').eq(index).addClass('active');
|
|
|
|
|
|
if ($('.product-tab').eq(index).find('li').length > 0) {
|
|
|
return false;
|
|
|
} else {
|
|
|
getProductData(index, tabName(index));
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
|
|
|
loading.hideLoadingMask();
|
...
|
...
|
|