Authored by 郭成尧

Merge branch 'develop' into release/4.6

... ... @@ -425,7 +425,7 @@ const getPreBrandTopData = (args, type) => {
preferenceBrands: {
name: title,
imgBrand: [],
brandUrl: helpers.urlFormat('getbrandFloorDataAjax?channelType=' + type)
brandUrl: '/getbrandFloorDataAjax?channelType=' + type
}
};
... ... @@ -794,7 +794,7 @@ const requestContent = type => {
limit: 1000
});
return serviceApi.get('/operations/api/v5/resource/home', data).then(res => {
return serviceApi.get('operations/api/v5/resource/home', data).then(res => {
if (res.code === 200) {
return res;
} else {
... ...
... ... @@ -7,28 +7,40 @@ exports.init = function(selector) {
var $imgBrand = $(selector);
var slider = $imgBrand.unslider({
autoplay: true,
delay: 3000,
arrows: {
},
nav: false,
animate: 'fade'
delay: 5000,
arrows: false,
nav: false
});
var imgBrandNum = $imgBrand.find('li').length;
var rows = imgBrandNum / 3;
var cols = imgBrandNum / 3;
var changeSliderTimeout;
if (!($imgBrand.find('li').length % 3)) {
rows -= 1;
cols -= 1;
}
$imgBrand.find('li:nth-child(3n)').css('margin-right', 0);
slider.on('unslider.change', function(event, index) {
if (index > rows) {
slider.unslider('animate:' + imgBrandNum);
clearTimeout(changeSliderTimeout);
if (index >= cols) {
changeSliderTimeout = setTimeout(function() {
slider.unslider('animate:first');
}, 4999);
}
});
// TODO: 手动点击左右
$('.img-brand-switch').on('click', '.prev', function() {
if (slider.data('unslider').current > cols || slider.data('unslider').current <= 0) {
slider.unslider('animate:' + cols);
} else {
slider.unslider('prev');
}
}).on('click', '.next', function() {
if (slider.data('unslider').current >= cols) {
slider.unslider('animate:first');
} else {
slider.unslider('next');
}
});
};
... ...