@fonixtree/magic-design 0.0.93 → 0.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/es/composite-comp/bol/components/Banner/pc/index.js +1 -14
  2. package/es/composite-comp/bol/components/Carousel/imgs/pcDefImg1.png +0 -0
  3. package/es/composite-comp/bol/components/Carousel/mobile/index.js +6 -36
  4. package/es/composite-comp/bol/components/Carousel/mobile/index.less +12 -5
  5. package/es/composite-comp/bol/components/Carousel/pc/index.js +6 -36
  6. package/es/composite-comp/bol/components/Carousel/pc/index.less +12 -9
  7. package/es/composite-comp/bol/components/ImageGallery/imgs/defImg1.png +0 -0
  8. package/es/composite-comp/bol/components/ImageGallery/imgs/defImg2.png +0 -0
  9. package/es/composite-comp/bol/components/ImageGallery/imgs/defImg3.png +0 -0
  10. package/es/composite-comp/bol/components/ImageGallery/imgs/defImg4.png +0 -0
  11. package/es/composite-comp/bol/components/ImageGallery/imgs/defImg5.png +0 -0
  12. package/es/composite-comp/bol/components/ImageGallery/imgs/pcDefImg1.png +0 -0
  13. package/es/composite-comp/bol/components/ImageGallery/imgs/pcDefImg2.png +0 -0
  14. package/es/composite-comp/bol/components/ImageGallery/imgs/pcDefImg3.png +0 -0
  15. package/es/composite-comp/bol/components/ImageGallery/imgs/pcDefImg4.png +0 -0
  16. package/es/composite-comp/bol/components/ImageGallery/imgs/pcDefImg5.png +0 -0
  17. package/es/composite-comp/bol/components/ImageGallery/imgs/pcDefImg6.png +0 -0
  18. package/es/composite-comp/bol/components/ImageGallery/mobile/index.js +38 -14
  19. package/es/composite-comp/bol/components/ImageGallery/mobile/index.less +17 -13
  20. package/es/composite-comp/bol/components/ImageGallery/pc/index.js +41 -15
  21. package/es/composite-comp/bol/components/ImageGallery/pc/index.less +18 -13
  22. package/es/composite-comp/common/components/ProductItem/index.js +1 -1
  23. package/es/composite-comp/common/components/ProductItem/index.less +2 -0
  24. package/es/composite-comp/common/config-panels/CustomizeConfig/index.js +8 -2
  25. package/es/composite-comp/dito/components/FlashDeal/mobile/index.js +1 -15
  26. package/es/composite-comp/dito/components/FlashDeal/pc/index.js +1 -15
  27. package/es/composite-comp/dito/components/Recommend/mobile/index.js +21 -29
  28. package/es/composite-comp/dito/components/Recommend/mobile/index.less +1 -0
  29. package/es/composite-comp/dito/components/Recommend/pc/index.js +31 -32
  30. package/es/composite-comp/dito/components/Recommend/pc/index.less +1 -0
  31. package/es/core/Designer/ViewArea/index.js +3 -1
  32. package/es/core/Designer/ViewArea/index.less +14 -3
  33. package/es/decorator/compositeDecorator.js +3 -2
  34. package/es/meta-comp/components/Image/image/h5DefImg.png +0 -0
  35. package/es/meta-comp/components/Image/image/h5Img.png +0 -0
  36. package/es/meta-comp/components/Image/image/pcDefImg.png +0 -0
  37. package/es/meta-comp/components/Image/image/pcImg.png +0 -0
  38. package/es/meta-comp/components/Image/index.js +6 -3
  39. package/lib/composite-comp/bol/components/Banner/pc/index.js +1 -14
  40. package/lib/composite-comp/bol/components/Carousel/imgs/pcDefImg1.png +0 -0
  41. package/lib/composite-comp/bol/components/Carousel/mobile/index.js +6 -36
  42. package/lib/composite-comp/bol/components/Carousel/mobile/index.less +12 -5
  43. package/lib/composite-comp/bol/components/Carousel/pc/index.js +6 -36
  44. package/lib/composite-comp/bol/components/Carousel/pc/index.less +12 -9
  45. package/lib/composite-comp/bol/components/ImageGallery/imgs/defImg1.png +0 -0
  46. package/lib/composite-comp/bol/components/ImageGallery/imgs/defImg2.png +0 -0
  47. package/lib/composite-comp/bol/components/ImageGallery/imgs/defImg3.png +0 -0
  48. package/lib/composite-comp/bol/components/ImageGallery/imgs/defImg4.png +0 -0
  49. package/lib/composite-comp/bol/components/ImageGallery/imgs/defImg5.png +0 -0
  50. package/lib/composite-comp/bol/components/ImageGallery/imgs/pcDefImg1.png +0 -0
  51. package/lib/composite-comp/bol/components/ImageGallery/imgs/pcDefImg2.png +0 -0
  52. package/lib/composite-comp/bol/components/ImageGallery/imgs/pcDefImg3.png +0 -0
  53. package/lib/composite-comp/bol/components/ImageGallery/imgs/pcDefImg4.png +0 -0
  54. package/lib/composite-comp/bol/components/ImageGallery/imgs/pcDefImg5.png +0 -0
  55. package/lib/composite-comp/bol/components/ImageGallery/imgs/pcDefImg6.png +0 -0
  56. package/lib/composite-comp/bol/components/ImageGallery/mobile/index.js +38 -14
  57. package/lib/composite-comp/bol/components/ImageGallery/mobile/index.less +17 -13
  58. package/lib/composite-comp/bol/components/ImageGallery/pc/index.js +41 -15
  59. package/lib/composite-comp/bol/components/ImageGallery/pc/index.less +18 -13
  60. package/lib/composite-comp/common/components/ProductItem/index.js +1 -1
  61. package/lib/composite-comp/common/components/ProductItem/index.less +2 -0
  62. package/lib/composite-comp/common/config-panels/CustomizeConfig/index.js +8 -2
  63. package/lib/composite-comp/dito/components/FlashDeal/mobile/index.js +1 -15
  64. package/lib/composite-comp/dito/components/FlashDeal/pc/index.js +1 -15
  65. package/lib/composite-comp/dito/components/Recommend/mobile/index.js +21 -29
  66. package/lib/composite-comp/dito/components/Recommend/mobile/index.less +1 -0
  67. package/lib/composite-comp/dito/components/Recommend/pc/index.js +31 -32
  68. package/lib/composite-comp/dito/components/Recommend/pc/index.less +1 -0
  69. package/lib/core/Designer/ViewArea/index.js +3 -1
  70. package/lib/core/Designer/ViewArea/index.less +14 -3
  71. package/lib/decorator/compositeDecorator.js +3 -2
  72. package/lib/meta-comp/components/Image/image/h5DefImg.png +0 -0
  73. package/lib/meta-comp/components/Image/image/h5Img.png +0 -0
  74. package/lib/meta-comp/components/Image/image/pcDefImg.png +0 -0
  75. package/lib/meta-comp/components/Image/image/pcImg.png +0 -0
  76. package/lib/meta-comp/components/Image/index.js +6 -3
  77. package/package.json +1 -1
@@ -5,6 +5,12 @@
5
5
  .content {
6
6
  display: flex;
7
7
  margin: 0 auto;
8
+
9
+ &.isHorizontal {
10
+ .slick-track {
11
+ gap: 0;
12
+ }
13
+ }
8
14
  }
9
15
 
10
16
  .carousel-icon-left {
@@ -22,13 +28,15 @@
22
28
  margin: 0 auto;
23
29
  line-height: 1;
24
30
 
25
- .img-wrap {
26
- overflow-x: auto;
31
+ .slick-track {
32
+ display: flex;
33
+ align-items: center;
34
+ gap: 24px;
35
+ }
27
36
 
37
+ .img-wrap {
28
38
  .img {
29
39
  width: fit-content;
30
- height: fit-content;
31
- display: block;
32
40
  margin: 0 auto;
33
41
  }
34
42
 
@@ -61,11 +69,6 @@
61
69
  }
62
70
  }
63
71
  }
64
-
65
- .slick-track {
66
- display: flex;
67
- align-items: center;
68
- }
69
72
  }
70
73
 
71
74
  .swiper-ban {
@@ -41,6 +41,20 @@ var __extends = void 0 && (void 0).__extends || function () {
41
41
  };
42
42
  }();
43
43
 
44
+ var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
45
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
46
+ s += arguments[i].length;
47
+ }
48
+
49
+ for (var r = Array(s), k = 0, i = 0; i < il; i++) {
50
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
51
+ r[k] = a[j];
52
+ }
53
+ }
54
+
55
+ return r;
56
+ };
57
+
44
58
  var MOBILE_IMG_SIZE = {
45
59
  1: {
46
60
  maxW: 343,
@@ -85,26 +99,36 @@ function (_super) {
85
99
  var data = this.props.data;
86
100
  var isHorizontal = data.customize.layout.h5Layout === 'layout2';
87
101
  var colNum = isHorizontal ? data.customize.rowNum : 1;
102
+ var newData = data.groupSource.reduce(function (prev, curr, index) {
103
+ var i = Math.floor(index / colNum);
104
+ prev[i] = __spreadArrays(prev[i] || [], [curr]);
105
+ return prev;
106
+ }, []);
88
107
  return /*#__PURE__*/_react["default"].createElement("div", {
89
108
  className: "m-image-gallery-mobile"
90
109
  }, /*#__PURE__*/_react["default"].createElement("div", {
91
- className: (0, _classnames["default"])('content', {
92
- horizontal: isHorizontal
93
- }),
94
- style: {
95
- gap: MOBILE_IMG_SIZE[colNum].gap
96
- }
97
- }, data.groupSource.map(function (m) {
110
+ className: "content"
111
+ }, newData.map(function (arr, index) {
98
112
  return /*#__PURE__*/_react["default"].createElement("div", {
99
- key: m.id,
100
- className: "img-wrap",
113
+ key: index,
114
+ className: (0, _classnames["default"])('line', {
115
+ isHorizontal: isHorizontal
116
+ }),
101
117
  style: {
102
- width: MOBILE_IMG_SIZE[colNum].maxW
118
+ gap: MOBILE_IMG_SIZE[colNum].gap
103
119
  }
104
- }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
105
- data: m.image,
106
- maxHeight: MOBILE_IMG_SIZE[colNum].maxH,
107
- maxWidth: MOBILE_IMG_SIZE[colNum].maxW
120
+ }, arr.map(function (item) {
121
+ return /*#__PURE__*/_react["default"].createElement("div", {
122
+ key: item.id,
123
+ className: "img-wrap",
124
+ style: {
125
+ width: "calc((100% - " + MOBILE_IMG_SIZE[colNum].gap * (colNum - 1) + "px) / " + colNum + ")"
126
+ }
127
+ }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
128
+ data: item.image,
129
+ maxHeight: MOBILE_IMG_SIZE[colNum].maxH,
130
+ maxWidth: MOBILE_IMG_SIZE[colNum].maxW
131
+ }));
108
132
  }));
109
133
  })));
110
134
  };
@@ -1,21 +1,25 @@
1
1
  .m-image-gallery-mobile {
2
- overflow-x: auto;
3
-
4
2
  .content {
5
- display: flex;
6
- flex-direction: column;
7
- flex-wrap: wrap;
8
- width: 345px;
3
+ max-width: 345px;
9
4
  margin: 0 auto;
10
5
 
11
- &.horizontal {
12
- flex-direction: row;
13
- }
6
+ .line {
7
+ margin-bottom: 12px;
8
+
9
+ &.isHorizontal {
10
+ display: flex;
11
+ justify-content: flex-start;
12
+ }
13
+
14
+ &:last-child {
15
+ margin-bottom: 0;
16
+ }
14
17
 
15
- .img-wrap {
16
- display: flex;
17
- align-items: center;
18
- justify-content: center;
18
+ .img-wrap {
19
+ display: flex;
20
+ align-items: center;
21
+ justify-content: center;
22
+ }
19
23
  }
20
24
  }
21
25
  }
@@ -41,10 +41,24 @@ var __extends = void 0 && (void 0).__extends || function () {
41
41
  };
42
42
  }();
43
43
 
44
+ var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
45
+ for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
46
+ s += arguments[i].length;
47
+ }
48
+
49
+ for (var r = Array(s), k = 0, i = 0; i < il; i++) {
50
+ for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
51
+ r[k] = a[j];
52
+ }
53
+ }
54
+
55
+ return r;
56
+ };
57
+
44
58
  var PC_IMG_SIZE = {
45
59
  1: {
46
60
  minW: 150,
47
- maxW: '100%',
61
+ maxW: 1280,
48
62
  minH: 150,
49
63
  maxH: 960,
50
64
  gap: 20
@@ -102,26 +116,38 @@ function (_super) {
102
116
  var data = this.props.data;
103
117
  var isHorizontal = data.customize.layout.pcLayout === 'layout2';
104
118
  var colNum = isHorizontal ? data.customize.pcRowNum : 1;
119
+ var newData = data.groupSource.reduce(function (prev, curr, index) {
120
+ var i = Math.floor(index / colNum);
121
+ prev[i] = __spreadArrays(prev[i] || [], [curr]);
122
+ return prev;
123
+ }, []);
105
124
  return /*#__PURE__*/_react["default"].createElement("div", {
106
125
  className: "m-image-gallery-pc"
107
126
  }, /*#__PURE__*/_react["default"].createElement("div", {
108
- className: (0, _classnames["default"])('content', {
109
- horizontal: isHorizontal
110
- }),
111
- style: {
112
- gap: PC_IMG_SIZE[colNum].gap
113
- }
114
- }, data.groupSource.map(function (m) {
127
+ className: "content"
128
+ }, newData.map(function (arr, index) {
115
129
  return /*#__PURE__*/_react["default"].createElement("div", {
116
- key: m.id,
117
- className: "img-wrap",
130
+ key: index,
131
+ className: (0, _classnames["default"])('line', {
132
+ isHorizontal: isHorizontal
133
+ }),
118
134
  style: {
119
- width: PC_IMG_SIZE[colNum].maxW
135
+ gap: PC_IMG_SIZE[colNum].gap
120
136
  }
121
- }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
122
- data: m.image,
123
- maxHeight: PC_IMG_SIZE[colNum].maxH,
124
- maxWidth: PC_IMG_SIZE[colNum].maxW
137
+ }, arr.map(function (item) {
138
+ return /*#__PURE__*/_react["default"].createElement("div", {
139
+ key: item.id,
140
+ className: "img-wrap",
141
+ style: {
142
+ width: "calc((100% - " + PC_IMG_SIZE[colNum].gap * (colNum - 1) + "px) / " + colNum + ")"
143
+ }
144
+ }, /*#__PURE__*/_react["default"].createElement(_components.MetaImage, {
145
+ data: item.image,
146
+ maxHeight: PC_IMG_SIZE[colNum].maxH,
147
+ maxWidth: PC_IMG_SIZE[colNum].maxW,
148
+ minHeight: PC_IMG_SIZE[colNum].minH,
149
+ minWidth: PC_IMG_SIZE[colNum].minW
150
+ }));
125
151
  }));
126
152
  })));
127
153
  };
@@ -1,21 +1,26 @@
1
1
  .m-image-gallery-pc {
2
- overflow-x: auto;
3
-
4
2
  .content {
5
- display: flex;
6
- flex-direction: column;
7
- flex-wrap: wrap;
8
- width: 1280px;
3
+ max-width: 1280px;
9
4
  margin: 0 auto;
10
5
 
11
- &.horizontal {
12
- flex-direction: row;
13
- }
6
+ .line {
7
+ margin-bottom: 20px;
8
+
9
+ &.isHorizontal {
10
+ margin-bottom: 24px;
11
+ display: flex;
12
+ justify-content: flex-start;
13
+ }
14
+
15
+ &:last-child {
16
+ margin-bottom: 0;
17
+ }
14
18
 
15
- .img-wrap {
16
- display: flex;
17
- align-items: center;
18
- justify-content: center;
19
+ .img-wrap {
20
+ display: flex;
21
+ align-items: center;
22
+ justify-content: center;
23
+ }
19
24
  }
20
25
  }
21
26
  }
@@ -167,7 +167,7 @@ function (_super) {
167
167
  className: "content-wrap"
168
168
  }, panelProps.label.open && /*#__PURE__*/_react["default"].createElement("div", {
169
169
  className: "promotions-wrap"
170
- }, promotions.map(function (promot, index) {
170
+ }, ['promotion', 'recommend', 'helloworld'].map(function (promot, index) {
171
171
  return /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
172
172
  key: index,
173
173
  className: "promotion-item",
@@ -132,6 +132,8 @@
132
132
  &.fixHeight {
133
133
  .promotions-wrap {
134
134
  height: 30px;
135
+ flex-wrap: nowrap;
136
+ overflow: hidden;
135
137
  }
136
138
 
137
139
  .product-name {
@@ -185,9 +185,15 @@ function (_super) {
185
185
  }
186
186
 
187
187
  CustomizeConfig.prototype.componentDidMount = function () {
188
- var _a;
188
+ var _a = this.props,
189
+ selectedLayoutFun = _a.selectedLayoutFun,
190
+ data = _a.data;
189
191
 
190
- this.onInit((_a = this.props.data) === null || _a === void 0 ? void 0 : _a.layout);
192
+ if (selectedLayoutFun) {
193
+ this.onInit((0, _coreUtil.isPc)() ? data.layout.pcLayout : data.layout.h5Layout);
194
+ } else {
195
+ this.onInit(data.layout);
196
+ }
191
197
  };
192
198
 
193
199
  CustomizeConfig.prototype.render = function () {
@@ -383,22 +383,8 @@ function (_super) {
383
383
 
384
384
  var _list = list.length === 0 && (0, _coreUtil.isDesignMode)() ? defaultData : list;
385
385
 
386
- var bgStyle = {};
387
-
388
- if (panelProps.background.bgType === 'color') {
389
- bgStyle = {
390
- backgroundColor: (0, _commonUtil.getColorRgba)(panelProps.background.color || '#fff', panelProps.background.opacity / 100 || 1)
391
- };
392
- } else {
393
- bgStyle = {
394
- background: "url(" + panelProps.background.image + ") no-repeat center",
395
- backgroundSize: '100%'
396
- };
397
- }
398
-
399
386
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _list.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
400
- className: "m-flash-deal-mobile",
401
- style: bgStyle
387
+ className: "m-flash-deal-mobile"
402
388
  }, /*#__PURE__*/_react["default"].createElement("div", {
403
389
  className: "flash-deal-title"
404
390
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -484,24 +484,10 @@ function (_super) {
484
484
 
485
485
  var _list = list.length === 0 && (0, _coreUtil.isDesignMode)() ? defaultData : list;
486
486
 
487
- var bgStyle = {};
488
-
489
- if (panelProps.background.bgType === 'color') {
490
- bgStyle = {
491
- backgroundColor: (0, _commonUtil.getColorRgba)(panelProps.background.color || '#fff', panelProps.background.opacity / 100 || 1)
492
- };
493
- } else {
494
- bgStyle = {
495
- background: "url(" + panelProps.background.image + ") no-repeat center",
496
- backgroundSize: '100%'
497
- };
498
- }
499
-
500
487
  var imgHeight = panelProps.customize.pcRowNum === 6 ? 153 : 193;
501
488
  var imgWidth = panelProps.customize.pcRowNum === 6 ? 153 : 193;
502
489
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _list.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
503
- className: "m-flash-deal-pc",
504
- style: bgStyle
490
+ className: "m-flash-deal-pc"
505
491
  }, /*#__PURE__*/_react["default"].createElement("div", {
506
492
  className: "flash-deal-title"
507
493
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -343,8 +343,11 @@ function (_super) {
343
343
  _k.label = 1;
344
344
 
345
345
  case 1:
346
- _k.trys.push([1, 7,, 8]);
346
+ _k.trys.push([1, 9,, 10]);
347
347
 
348
+ if (!(groupSource.length > 0)) return [3
349
+ /*break*/
350
+ , 7];
348
351
  if (!(sourceType === 'select')) return [3
349
352
  /*break*/
350
353
  , 3];
@@ -401,13 +404,22 @@ function (_super) {
401
404
  , 8];
402
405
 
403
406
  case 7:
407
+ newData = [];
408
+ _k.label = 8;
409
+
410
+ case 8:
411
+ return [3
412
+ /*break*/
413
+ , 10];
414
+
415
+ case 9:
404
416
  e_1 = _k.sent();
405
417
  newData = [];
406
418
  return [3
407
419
  /*break*/
408
- , 8];
420
+ , 10];
409
421
 
410
- case 8:
422
+ case 10:
411
423
  if (!(0, _coreUtil.isDesignMode)()) {
412
424
  _cache = (0, _storeUtil.getMagicStore)("recommend_" + recommendId);
413
425
  (0, _storeUtil.setMagicStore)("recommend_" + recommendId, __assign(__assign({}, _cache), (_h = {}, _h["products" + index] = newData, _h.endTime = Date.now() + 3 * 60 * 1000, _h)));
@@ -456,24 +468,6 @@ function (_super) {
456
468
  }, true);
457
469
  };
458
470
 
459
- _this.getBackgroundStyle = function () {
460
- var panelProps = _this.props.panelProps;
461
- var bgStyle = {};
462
-
463
- if (panelProps.background.bgType === 'color') {
464
- bgStyle = {
465
- backgroundColor: (0, _commonUtil.getColorRgba)(panelProps.background.color || '#fff', panelProps.background.opacity / 100 || 1)
466
- };
467
- } else {
468
- bgStyle = {
469
- background: "url(" + panelProps.background.image + ") no-repeat center",
470
- backgroundSize: '100%'
471
- };
472
- }
473
-
474
- return bgStyle;
475
- };
476
-
477
471
  _this.onTabClick = function (e, index) {
478
472
  var tabIndex = _this.state.tabIndex;
479
473
  if (tabIndex === index) return; // e.currentTarget.scrollIntoView(false);
@@ -511,11 +505,11 @@ function (_super) {
511
505
  this.listenWidth();
512
506
  };
513
507
 
514
- RecommendMobile.prototype.componentWillReceiveProps = function () {
508
+ RecommendMobile.prototype.componentWillReceiveProps = function (nextProps) {
515
509
  var _this = this;
516
510
 
517
511
  var tabIndex = this.state.tabIndex;
518
- var panelProps = this.props.panelProps;
512
+ var panelProps = nextProps.panelProps;
519
513
  var source = [];
520
514
  var hideTabs = false;
521
515
  panelProps.groupSource.map(function (m) {
@@ -523,8 +517,8 @@ function (_super) {
523
517
  if (show) source.push(m);
524
518
  });
525
519
 
526
- if (source.length === 0 && panelProps.groupSource.length > 0) {
527
- source.push(panelProps.groupSource[0]);
520
+ if (source.length === 0) {
521
+ if (panelProps.groupSource.length > 0) source.push(panelProps.groupSource[0]);
528
522
  hideTabs = true;
529
523
  }
530
524
 
@@ -578,7 +572,6 @@ function (_super) {
578
572
  groupSource = _a.groupSource,
579
573
  hideTabs = _a.hideTabs,
580
574
  contentWidth = _a.contentWidth;
581
- var bgStyle = this.getBackgroundStyle();
582
575
  var products = this.state["products" + tabIndex] || [];
583
576
  var isDivide = groupSource.length <= 3;
584
577
  var layout = panelProps.customize.layout.h5Layout;
@@ -596,8 +589,7 @@ function (_super) {
596
589
  if (layout === 'layout1' && contentWidth) imgHeight = (contentWidth - 12) / 2;
597
590
  if (layout === 'layout3' && contentWidth) imgHeight = (contentWidth - 12 * 2) / 3;
598
591
  return /*#__PURE__*/_react["default"].createElement("div", {
599
- className: "m-recommend-mobile",
600
- style: bgStyle
592
+ className: "m-recommend-mobile"
601
593
  }, !hideTabs && /*#__PURE__*/_react["default"].createElement("div", {
602
594
  className: "tab-select-wrap"
603
595
  }, groupSource.map(function (tab, index) {
@@ -628,7 +620,7 @@ function (_super) {
628
620
  tab.groupName.text = text;
629
621
  }
630
622
  }));
631
- }), /*#__PURE__*/_react["default"].createElement("div", {
623
+ }), groupSource.length > 0 && /*#__PURE__*/_react["default"].createElement("div", {
632
624
  className: "active-line",
633
625
  style: {
634
626
  width: tabWidth,
@@ -25,6 +25,7 @@
25
25
  .tabTitle {
26
26
  display: flex;
27
27
  align-items: center;
28
+ text-align: center;
28
29
  padding: 0 24px;
29
30
  width: fit-content;
30
31
  height: 100%;
@@ -13,7 +13,9 @@ require("./index.less");
13
13
 
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
15
 
16
- var _lodash = _interopRequireDefault(require("lodash.throttle"));
16
+ var _lodash = require("lodash");
17
+
18
+ var _lodash2 = _interopRequireDefault(require("lodash.throttle"));
17
19
 
18
20
  var _mobx = require("../../../../../mobx");
19
21
 
@@ -359,8 +361,11 @@ function (_super) {
359
361
  _k.label = 1;
360
362
 
361
363
  case 1:
362
- _k.trys.push([1, 7,, 8]);
364
+ _k.trys.push([1, 9,, 10]);
363
365
 
366
+ if (!(groupSource.length > 0)) return [3
367
+ /*break*/
368
+ , 7];
364
369
  if (!(sourceType === 'select')) return [3
365
370
  /*break*/
366
371
  , 3];
@@ -417,13 +422,22 @@ function (_super) {
417
422
  , 8];
418
423
 
419
424
  case 7:
425
+ newData = [];
426
+ _k.label = 8;
427
+
428
+ case 8:
429
+ return [3
430
+ /*break*/
431
+ , 10];
432
+
433
+ case 9:
420
434
  e_1 = _k.sent();
421
435
  newData = [];
422
436
  return [3
423
437
  /*break*/
424
- , 8];
438
+ , 10];
425
439
 
426
- case 8:
440
+ case 10:
427
441
  if (!(0, _coreUtil.isDesignMode)()) {
428
442
  _cache = (0, _storeUtil.getMagicStore)("recommend_" + recommendId);
429
443
  (0, _storeUtil.setMagicStore)("recommend_" + recommendId, __assign(__assign({}, _cache), (_h = {}, _h["products" + index] = newData, _h.endTime = Date.now() + 3 * 60 * 1000, _h)));
@@ -467,24 +481,6 @@ function (_super) {
467
481
  }, true);
468
482
  };
469
483
 
470
- _this.getBackgroundStyle = function () {
471
- var panelProps = _this.props.panelProps;
472
- var bgStyle = {};
473
-
474
- if (panelProps.background.bgType === 'color') {
475
- bgStyle = {
476
- backgroundColor: (0, _commonUtil.getColorRgba)(panelProps.background.color || '#fff', panelProps.background.opacity / 100 || 1)
477
- };
478
- } else {
479
- bgStyle = {
480
- background: "url(" + panelProps.background.image + ") no-repeat center",
481
- backgroundSize: '100%'
482
- };
483
- }
484
-
485
- return bgStyle;
486
- };
487
-
488
484
  _this.onTabClick = function (e, index) {
489
485
  var tabIndex = _this.state.tabIndex;
490
486
  if (tabIndex === index) return; // e.currentTarget.scrollIntoView(false);
@@ -505,7 +501,7 @@ function (_super) {
505
501
  if (scrollDom) {
506
502
  _this.setScrollDisabled(scrollDom);
507
503
 
508
- scrollDom.onscroll = (0, _lodash["default"])(function () {
504
+ scrollDom.onscroll = (0, _lodash2["default"])(function () {
509
505
  _this.setScrollDisabled(scrollDom);
510
506
  }, 500);
511
507
  }
@@ -553,19 +549,24 @@ function (_super) {
553
549
  if (scrollDom) {
554
550
  _this.setScrollDisabled(scrollDom);
555
551
 
556
- scrollDom.onscroll = (0, _lodash["default"])(function () {
552
+ scrollDom.onscroll = (0, _lodash2["default"])(function () {
557
553
  _this.setScrollDisabled(scrollDom);
558
554
  }, 500);
559
555
  }
560
556
  }, 0);
561
557
  this.listenWidth();
558
+ window.addEventListener('resize', (0, _lodash.debounce)(this.listenWidth));
559
+ };
560
+
561
+ RecommendMobile.prototype.componentWillUnmount = function () {
562
+ window.removeEventListener('resize', this.listenWidth);
562
563
  };
563
564
 
564
- RecommendMobile.prototype.componentWillReceiveProps = function () {
565
+ RecommendMobile.prototype.componentWillReceiveProps = function (nextProps) {
565
566
  var _this = this;
566
567
 
567
568
  var tabIndex = this.state.tabIndex;
568
- var panelProps = this.props.panelProps;
569
+ var panelProps = nextProps.panelProps;
569
570
  var source = [];
570
571
  var hideTabs = false;
571
572
  panelProps.groupSource.map(function (m) {
@@ -573,8 +574,8 @@ function (_super) {
573
574
  if (show) source.push(m);
574
575
  });
575
576
 
576
- if (source.length === 0 && panelProps.groupSource.length > 0) {
577
- source.push(panelProps.groupSource[0]);
577
+ if (source.length === 0) {
578
+ if (panelProps.groupSource.length > 0) source.push(panelProps.groupSource[0]);
578
579
  hideTabs = true;
579
580
  }
580
581
 
@@ -610,7 +611,7 @@ function (_super) {
610
611
  if (scrollDom) {
611
612
  _this.setScrollDisabled(scrollDom);
612
613
 
613
- scrollDom.onscroll = (0, _lodash["default"])(function () {
614
+ scrollDom.onscroll = (0, _lodash2["default"])(function () {
614
615
  _this.setScrollDisabled(scrollDom);
615
616
  }, 500);
616
617
  }
@@ -646,7 +647,6 @@ function (_super) {
646
647
  scrollToLeftDisabled = _a.scrollToLeftDisabled,
647
648
  scrollToRightDisabled = _a.scrollToRightDisabled,
648
649
  contentWidth = _a.contentWidth;
649
- var bgStyle = this.getBackgroundStyle();
650
650
  var products = this.state["products" + tabIndex] || [];
651
651
  var isDivide = groupSource.length <= 10;
652
652
  var layout = panelProps.customize.layout.pcLayout;
@@ -663,8 +663,7 @@ function (_super) {
663
663
  }, 140);
664
664
  if (layout === 'layout1' && contentWidth) imgHeight = (contentWidth - 12 * (panelProps.customize.pcRowNum - 1)) / panelProps.customize.pcRowNum;
665
665
  return /*#__PURE__*/_react["default"].createElement("div", {
666
- className: "m-recommend-pc",
667
- style: bgStyle
666
+ className: "m-recommend-pc"
668
667
  }, !hideTabs && /*#__PURE__*/_react["default"].createElement("div", {
669
668
  className: "tab-select-wrap"
670
669
  }, groupSource.map(function (tab, index) {
@@ -25,6 +25,7 @@
25
25
  .tabTitle {
26
26
  display: flex;
27
27
  align-items: center;
28
+ text-align: center;
28
29
  // padding: 0 24px;
29
30
  min-width: 100px;
30
31
  height: 100%;