|
@@ -881,12 +881,53 @@ function activityPlan() { |
|
@@ -881,12 +881,53 @@ function activityPlan() { |
881
|
}
|
881
|
}
|
882
|
}
|
882
|
}
|
883
|
|
883
|
|
|
|
884
|
+function changeShopAndProductHeightSingle(parent, className) {
|
|
|
885
|
+ let img = $(parent).find('.' + className);
|
|
|
886
|
+
|
|
|
887
|
+ if (img[0] && !img.hasClass('completed')) {
|
|
|
888
|
+ // console.log(img[0].src, /(\.jpg|\.png)/.test(img[0].src));
|
|
|
889
|
+ if (/(\.jpg|\.png)/.test(img[0].src)) {
|
|
|
890
|
+ let image = new Image();
|
|
|
891
|
+
|
|
|
892
|
+ image.src = img[0].src;
|
|
|
893
|
+ image.onload = function() {
|
|
|
894
|
+ img.removeClass(className);
|
|
|
895
|
+ img.addClass('completed');
|
|
|
896
|
+ let height = $(parent).find('.product-wrapper .feature-product-info').height();
|
|
|
897
|
+
|
|
|
898
|
+ $(parent).find('.shop-wrapper .feature-shop-info').height(height);
|
|
|
899
|
+ };
|
|
|
900
|
+ } else {
|
|
|
901
|
+ setTimeout(changeShopAndProductHeightSingle, 300, parent, className);
|
|
|
902
|
+ }
|
|
|
903
|
+ }
|
|
|
904
|
+}
|
|
|
905
|
+
|
884
|
// 改变店铺+商品组中店铺的高度
|
906
|
// 改变店铺+商品组中店铺的高度
|
885
|
function changeShopAndProductHeight() {
|
907
|
function changeShopAndProductHeight() {
|
886
|
$('.shop-product-container').each(function() {
|
908
|
$('.shop-product-container').each(function() {
|
887
|
- let height = $(this).find('.product-wrapper .feature-product-info').height();
|
909
|
+ let img = $(this).find('.product-detail-img').eq(0);
|
|
|
910
|
+ let that = this;
|
|
|
911
|
+
|
|
|
912
|
+ if (img[0] && !img.hasClass('completed')) {
|
|
|
913
|
+ // console.log(img[0].src, /(\.jpg|\.png)/.test(img[0].src));
|
|
|
914
|
+ if (/(\.jpg|\.png)/.test(img[0].src)) {
|
|
|
915
|
+ let image = new Image();
|
|
|
916
|
+
|
|
|
917
|
+ image.src = img[0].src;
|
|
|
918
|
+ image.onload = function() {
|
|
|
919
|
+ img.addClass('completed');
|
|
|
920
|
+ let height = $(that).find('.product-wrapper .feature-product-info').height();
|
888
|
|
921
|
|
889
|
- $(this).find('.shop-wrapper .feature-shop-info').height(height);
|
922
|
+ $(that).find('.shop-wrapper .feature-shop-info').height(height);
|
|
|
923
|
+ };
|
|
|
924
|
+ } else {
|
|
|
925
|
+ let className = 'no-completed-' + Math.random().toString(16).substr(2, 8);
|
|
|
926
|
+
|
|
|
927
|
+ img.addClass(className);
|
|
|
928
|
+ setTimeout(changeShopAndProductHeightSingle, 300, that, className);
|
|
|
929
|
+ }
|
|
|
930
|
+ }
|
890
|
});
|
931
|
});
|
891
|
}
|
932
|
}
|
892
|
|
933
|
|
|
@@ -954,7 +995,7 @@ $(function() { |
|
@@ -954,7 +995,7 @@ $(function() { |
954
|
// 定时计划
|
995
|
// 定时计划
|
955
|
activityPlan();
|
996
|
activityPlan();
|
956
|
|
997
|
|
957
|
- setTimeout(changeShopAndProductHeight, 300);
|
998
|
+ changeShopAndProductHeight();
|
958
|
|
999
|
|
959
|
// 小程序相关处理
|
1000
|
// 小程序相关处理
|
960
|
if (!window.WeixinJSBridge || !window.WeixinJSBridge.invoke) {
|
1001
|
if (!window.WeixinJSBridge || !window.WeixinJSBridge.invoke) {
|