Authored by 陈峰

Merge branch 'feature/new-shop-product-floor' into 'release/6.8.6'

修复楼层背景错位



See merge request !1697
... ... @@ -352,6 +352,14 @@ class featureModel extends global.yoho.BaseModel {
}
// 对背景图做特殊处理
if (f.component && f.component[0] && f.component[0].type === 'productGroup') {
if (f.param.bgimg) { // 对背景图做特殊处理
f.param._bgimgFill = f.param.bgimg;
f.param.bgimg = '';
}
}
// 新增店铺组
if (componentType === 'shopGroup') {
shopGroups.push(self._getShopGroup(f.component[0]));
... ... @@ -376,6 +384,11 @@ class featureModel extends global.yoho.BaseModel {
} else if (shop.defaultSkn) {
componentArr.push(shop);
}
if (f.param.bgimg) { // 对背景图做特殊处理
f.param._bgimgFill = f.param.bgimg;
f.param.bgimg = '';
}
}
if (_.get(f, 'type') === 'bottombar') {
... ...
... ... @@ -881,12 +881,53 @@ function activityPlan() {
}
}
function changeShopAndProductHeightSingle(parent, className) {
let img = $(parent).find('.' + className);
if (img[0] && !img.hasClass('completed')) {
// console.log(img[0].src, /(\.jpg|\.png)/.test(img[0].src));
if (/(\.jpg|\.png)/.test(img[0].src)) {
let image = new Image();
image.src = img[0].src;
image.onload = function() {
img.removeClass(className);
img.addClass('completed');
let height = $(parent).find('.product-wrapper .feature-product-info').height();
$(parent).find('.shop-wrapper .feature-shop-info').height(height);
};
} else {
setTimeout(changeShopAndProductHeightSingle, 300, parent, className);
}
}
}
// 改变店铺+商品组中店铺的高度
function changeShopAndProductHeight() {
$('.shop-product-container').each(function() {
let height = $(this).find('.product-wrapper .feature-product-info').height();
let img = $(this).find('.product-detail-img').eq(0);
let that = this;
if (img[0] && !img.hasClass('completed')) {
// console.log(img[0].src, /(\.jpg|\.png)/.test(img[0].src));
if (/(\.jpg|\.png)/.test(img[0].src)) {
let image = new Image();
image.src = img[0].src;
image.onload = function() {
img.addClass('completed');
let height = $(that).find('.product-wrapper .feature-product-info').height();
$(this).find('.shop-wrapper .feature-shop-info').height(height);
$(that).find('.shop-wrapper .feature-shop-info').height(height);
};
} else {
let className = 'no-completed-' + Math.random().toString(16).substr(2, 8);
img.addClass(className);
setTimeout(changeShopAndProductHeightSingle, 300, that, className);
}
}
});
}
... ... @@ -954,7 +995,7 @@ $(function() {
// 定时计划
activityPlan();
setTimeout(changeShopAndProductHeight, 300);
changeShopAndProductHeight();
// 小程序相关处理
if (!window.WeixinJSBridge || !window.WeixinJSBridge.invoke) {
... ...