@fonixtree/magic-design 0.0.94 → 0.0.97
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.
- package/es/composite-comp/bol/components/Banner/pc/index.js +1 -14
- package/es/composite-comp/bol/components/Carousel/imgs/pcDefImg1.png +0 -0
- package/es/composite-comp/bol/components/Carousel/mobile/index.js +6 -36
- package/es/composite-comp/bol/components/Carousel/mobile/index.less +12 -5
- package/es/composite-comp/bol/components/Carousel/pc/index.js +6 -36
- package/es/composite-comp/bol/components/Carousel/pc/index.less +12 -9
- package/es/composite-comp/bol/components/ImageGallery/pc/index.js +1 -1
- package/es/composite-comp/common/components/ProductItem/index.less +2 -0
- package/es/composite-comp/dito/components/FlashDeal/mobile/index.js +1 -15
- package/es/composite-comp/dito/components/FlashDeal/pc/index.js +1 -15
- package/es/composite-comp/dito/components/PcNavigation/pc/index.js +6 -0
- package/es/composite-comp/dito/components/PcNavigation/pc/index.less +2 -1
- package/es/composite-comp/dito/components/Recommend/mobile/index.js +21 -29
- package/es/composite-comp/dito/components/Recommend/mobile/index.less +1 -0
- package/es/composite-comp/dito/components/Recommend/pc/index.js +31 -32
- package/es/composite-comp/dito/components/Recommend/pc/index.less +1 -0
- package/es/decorator/compositeDecorator.js +3 -2
- package/es/decorator/metaDecorator.js +2 -2
- package/es/meta-comp/components/Image/index.less +1 -1
- package/lib/composite-comp/bol/components/Banner/pc/index.js +1 -14
- package/lib/composite-comp/bol/components/Carousel/imgs/pcDefImg1.png +0 -0
- package/lib/composite-comp/bol/components/Carousel/mobile/index.js +6 -36
- package/lib/composite-comp/bol/components/Carousel/mobile/index.less +12 -5
- package/lib/composite-comp/bol/components/Carousel/pc/index.js +6 -36
- package/lib/composite-comp/bol/components/Carousel/pc/index.less +12 -9
- package/lib/composite-comp/bol/components/ImageGallery/pc/index.js +1 -1
- package/lib/composite-comp/common/components/ProductItem/index.less +2 -0
- package/lib/composite-comp/dito/components/FlashDeal/mobile/index.js +1 -15
- package/lib/composite-comp/dito/components/FlashDeal/pc/index.js +1 -15
- package/lib/composite-comp/dito/components/PcNavigation/pc/index.js +6 -0
- package/lib/composite-comp/dito/components/PcNavigation/pc/index.less +2 -1
- package/lib/composite-comp/dito/components/Recommend/mobile/index.js +21 -29
- package/lib/composite-comp/dito/components/Recommend/mobile/index.less +1 -0
- package/lib/composite-comp/dito/components/Recommend/pc/index.js +31 -32
- package/lib/composite-comp/dito/components/Recommend/pc/index.less +1 -0
- package/lib/decorator/compositeDecorator.js +3 -2
- package/lib/decorator/metaDecorator.js +2 -2
- package/lib/meta-comp/components/Image/index.less +1 -1
- package/package.json +1 -1
|
@@ -184,20 +184,7 @@ function (_super) {
|
|
|
184
184
|
|
|
185
185
|
BannerPc.prototype.componentWillUnmount = function () {
|
|
186
186
|
this.destroy();
|
|
187
|
-
};
|
|
188
|
-
// const { data } = this.props;
|
|
189
|
-
// const bgStyle = {
|
|
190
|
-
// justifyContent: alignItemMap[item.customize.layout],
|
|
191
|
-
// };
|
|
192
|
-
// if (item.background.bgType === 'color') {
|
|
193
|
-
// bgStyle.backgroundColor = getColorRgba(item.background.color || '#fff', item.background.opacity / 100 || 1);
|
|
194
|
-
// } else {
|
|
195
|
-
// bgStyle.backgroundImage = `url(${item.background.image})`;
|
|
196
|
-
// }
|
|
197
|
-
// if (data.setting.pcHeight) bgStyle.height = data.setting.pcHeight;
|
|
198
|
-
// return bgStyle;
|
|
199
|
-
// }
|
|
200
|
-
|
|
187
|
+
};
|
|
201
188
|
|
|
202
189
|
BannerPc.prototype.render = function () {
|
|
203
190
|
var _this = this;
|
|
Binary file
|
|
@@ -13,14 +13,10 @@ var _reactSlick = _interopRequireDefault(require("react-slick"));
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
16
|
var _coreUtil = require("../../../../../utils/coreUtil");
|
|
19
17
|
|
|
20
18
|
var _components = require("../../../../../meta-comp/components");
|
|
21
19
|
|
|
22
|
-
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
23
|
-
|
|
24
20
|
require("slick-carousel/slick/slick.css");
|
|
25
21
|
|
|
26
22
|
require("slick-carousel/slick/slick-theme.css");
|
|
@@ -99,19 +95,11 @@ function (_super) {
|
|
|
99
95
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
100
96
|
|
|
101
97
|
_this.state = {
|
|
102
|
-
sliderIndex: 0
|
|
103
|
-
contentWidth: 0
|
|
98
|
+
sliderIndex: 0
|
|
104
99
|
};
|
|
105
100
|
_this.sliderRef = /*#__PURE__*/_react["default"].createRef();
|
|
106
101
|
_this.destroy = null;
|
|
107
102
|
|
|
108
|
-
_this.listenWidth = function () {
|
|
109
|
-
var renderContainer = document.querySelector('.composite_wrap');
|
|
110
|
-
if (renderContainer) _this.setState({
|
|
111
|
-
contentWidth: renderContainer.offsetWidth
|
|
112
|
-
});
|
|
113
|
-
};
|
|
114
|
-
|
|
115
103
|
_this.sliderGoTo = function (groupSource) {
|
|
116
104
|
var nextIndex = groupSource.findIndex(function (item) {
|
|
117
105
|
return item.id === _mobx.store.clickedGroup;
|
|
@@ -173,8 +161,6 @@ function (_super) {
|
|
|
173
161
|
_this.sliderRef.slickPause();
|
|
174
162
|
}
|
|
175
163
|
});
|
|
176
|
-
this.listenWidth();
|
|
177
|
-
window.addEventListener('resize', (0, _lodash.debounce)(this.listenWidth));
|
|
178
164
|
};
|
|
179
165
|
|
|
180
166
|
CarouselMobile.prototype.componentWillReceiveProps = function (nextProps) {
|
|
@@ -195,24 +181,9 @@ function (_super) {
|
|
|
195
181
|
var _this = this;
|
|
196
182
|
|
|
197
183
|
var data = this.props.data;
|
|
198
|
-
var
|
|
199
|
-
sliderIndex = _a.sliderIndex,
|
|
200
|
-
contentWidth = _a.contentWidth;
|
|
184
|
+
var sliderIndex = this.state.sliderIndex;
|
|
201
185
|
var showText = data.customize.layout === 'layout2';
|
|
202
186
|
var colNum = showText ? 1 : Math.min(data.customize.rowNum, data.groupSource.length);
|
|
203
|
-
var bgStyle = {};
|
|
204
|
-
|
|
205
|
-
if (data.background.bgType === 'color') {
|
|
206
|
-
bgStyle = {
|
|
207
|
-
backgroundColor: (0, _commonUtil.getColorRgba)(data.background.color || '#fff', data.background.opacity / 100 || 1)
|
|
208
|
-
};
|
|
209
|
-
} else {
|
|
210
|
-
bgStyle = {
|
|
211
|
-
background: "url(" + data.background.image + ") no-repeat center",
|
|
212
|
-
backgroundSize: '100%'
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
187
|
var autoplay = data.setting.autoplay.open;
|
|
217
188
|
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
218
189
|
|
|
@@ -236,14 +207,13 @@ function (_super) {
|
|
|
236
207
|
});
|
|
237
208
|
}
|
|
238
209
|
};
|
|
239
|
-
var spacing = data.spacing[window.magicDesign.device];
|
|
240
210
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
241
|
-
className: "m-carousel-mobile"
|
|
242
|
-
style: bgStyle
|
|
211
|
+
className: "m-carousel-mobile"
|
|
243
212
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
244
|
-
className: "content
|
|
213
|
+
className: (0, _classnames["default"])('content', {
|
|
214
|
+
isHorizontal: colNum === 1
|
|
215
|
+
}),
|
|
245
216
|
style: {
|
|
246
|
-
width: contentWidth - spacing.paddingLeft - spacing.paddingRight,
|
|
247
217
|
paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '20px' : '0'
|
|
248
218
|
}
|
|
249
219
|
}, /*#__PURE__*/_react["default"].createElement(_reactSlick["default"], _extends({
|
|
@@ -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
|
.slider-wrap {
|
|
@@ -12,6 +18,12 @@
|
|
|
12
18
|
margin: 0 auto;
|
|
13
19
|
line-height: 1;
|
|
14
20
|
|
|
21
|
+
.slick-track {
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
gap: 12px;
|
|
25
|
+
}
|
|
26
|
+
|
|
15
27
|
.img-wrap {
|
|
16
28
|
.img {
|
|
17
29
|
width: fit-content;
|
|
@@ -49,11 +61,6 @@
|
|
|
49
61
|
}
|
|
50
62
|
}
|
|
51
63
|
}
|
|
52
|
-
|
|
53
|
-
.slick-track {
|
|
54
|
-
display: flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
}
|
|
57
64
|
}
|
|
58
65
|
|
|
59
66
|
.swiper-ban {
|
|
@@ -13,16 +13,12 @@ var _reactSlick = _interopRequireDefault(require("react-slick"));
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
-
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
16
|
var _coreUtil = require("../../../../../utils/coreUtil");
|
|
19
17
|
|
|
20
18
|
var _mobx = require("../../../../../mobx");
|
|
21
19
|
|
|
22
20
|
var _components = require("../../../../../meta-comp/components");
|
|
23
21
|
|
|
24
|
-
var _commonUtil = require("../../../../../utils/commonUtil");
|
|
25
|
-
|
|
26
22
|
var _Iconfont = _interopRequireDefault(require("../../../../../common/Iconfont"));
|
|
27
23
|
|
|
28
24
|
require("slick-carousel/slick/slick.css");
|
|
@@ -100,19 +96,11 @@ function (_super) {
|
|
|
100
96
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
101
97
|
|
|
102
98
|
_this.state = {
|
|
103
|
-
sliderIndex: 0
|
|
104
|
-
contentWidth: 0
|
|
99
|
+
sliderIndex: 0
|
|
105
100
|
};
|
|
106
101
|
_this.sliderRef = /*#__PURE__*/_react["default"].createRef();
|
|
107
102
|
_this.destroy = null;
|
|
108
103
|
|
|
109
|
-
_this.listenWidth = function () {
|
|
110
|
-
var renderContainer = document.querySelector('.composite_wrap');
|
|
111
|
-
if (renderContainer) _this.setState({
|
|
112
|
-
contentWidth: renderContainer.offsetWidth
|
|
113
|
-
});
|
|
114
|
-
};
|
|
115
|
-
|
|
116
104
|
_this.sliderGoTo = function (groupSource) {
|
|
117
105
|
var nextIndex = groupSource.findIndex(function (item) {
|
|
118
106
|
return item.id === _mobx.store.clickedGroup;
|
|
@@ -166,8 +154,6 @@ function (_super) {
|
|
|
166
154
|
_this.sliderRef.slickPause();
|
|
167
155
|
}
|
|
168
156
|
});
|
|
169
|
-
this.listenWidth();
|
|
170
|
-
window.addEventListener('resize', (0, _lodash.debounce)(this.listenWidth));
|
|
171
157
|
};
|
|
172
158
|
|
|
173
159
|
CarouselPc.prototype.componentWillReceiveProps = function (nextProps) {
|
|
@@ -188,24 +174,9 @@ function (_super) {
|
|
|
188
174
|
var _this = this;
|
|
189
175
|
|
|
190
176
|
var data = this.props.data;
|
|
191
|
-
var
|
|
192
|
-
sliderIndex = _a.sliderIndex,
|
|
193
|
-
contentWidth = _a.contentWidth;
|
|
177
|
+
var sliderIndex = this.state.sliderIndex;
|
|
194
178
|
var showText = data.customize.layout === 'layout2';
|
|
195
179
|
var colNum = showText ? 1 : Math.min(data.customize.pcRowNum, data.groupSource.length);
|
|
196
|
-
var bgStyle = {};
|
|
197
|
-
|
|
198
|
-
if (data.background.bgType === 'color') {
|
|
199
|
-
bgStyle = {
|
|
200
|
-
backgroundColor: (0, _commonUtil.getColorRgba)(data.background.color || '#fff', data.background.opacity / 100 || 1)
|
|
201
|
-
};
|
|
202
|
-
} else {
|
|
203
|
-
bgStyle = {
|
|
204
|
-
background: "url(" + data.background.image + ") no-repeat center",
|
|
205
|
-
backgroundSize: '100%'
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
|
|
209
180
|
var autoplay = data.setting.autoplay.open;
|
|
210
181
|
/** 设计器模式下 如果选中特定group 自动播放关闭 */
|
|
211
182
|
|
|
@@ -233,14 +204,13 @@ function (_super) {
|
|
|
233
204
|
fontSize: data.setting.navigation.size,
|
|
234
205
|
color: data.setting.navigation.color
|
|
235
206
|
};
|
|
236
|
-
var spacing = data.spacing[window.magicDesign.device];
|
|
237
207
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
238
|
-
className: "m-carousel-pc"
|
|
239
|
-
style: bgStyle
|
|
208
|
+
className: "m-carousel-pc"
|
|
240
209
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
241
|
-
className: "content
|
|
210
|
+
className: (0, _classnames["default"])('content', {
|
|
211
|
+
isHorizontal: colNum === 1
|
|
212
|
+
}),
|
|
242
213
|
style: {
|
|
243
|
-
width: contentWidth - spacing.paddingLeft - spacing.paddingRight,
|
|
244
214
|
paddingBottom: data.setting.dots.open && data.groupSource.length / colNum > 1 ? '30px' : '0'
|
|
245
215
|
}
|
|
246
216
|
}, data.setting.navigation.open && /*#__PURE__*/_react["default"].createElement(_Iconfont["default"], {
|
|
@@ -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
|
-
.
|
|
26
|
-
|
|
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 {
|
|
@@ -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", {
|
|
@@ -336,6 +336,8 @@ function (_super) {
|
|
|
336
336
|
};
|
|
337
337
|
|
|
338
338
|
_this.getListArr = function (pre, arr, index) {
|
|
339
|
+
console.log('---getListArr', pre, arr);
|
|
340
|
+
|
|
339
341
|
if (arr) {
|
|
340
342
|
pre[index] = arr.map(function (item) {
|
|
341
343
|
return __assign(__assign({}, item), {
|
|
@@ -346,6 +348,10 @@ function (_super) {
|
|
|
346
348
|
_this.setState({
|
|
347
349
|
list: pre.slice(0, index + 1)
|
|
348
350
|
});
|
|
351
|
+
} else if (pre[index]) {
|
|
352
|
+
_this.setState({
|
|
353
|
+
list: pre.slice(0, index)
|
|
354
|
+
});
|
|
349
355
|
}
|
|
350
356
|
};
|
|
351
357
|
|
|
@@ -90,12 +90,13 @@
|
|
|
90
90
|
|
|
91
91
|
.category-group {
|
|
92
92
|
display: flex;
|
|
93
|
-
overflow-x:
|
|
93
|
+
overflow-x: auto;
|
|
94
94
|
flex: 1;
|
|
95
95
|
scroll-snap-type: x;
|
|
96
96
|
.one-category {
|
|
97
97
|
margin-right: 44px;
|
|
98
98
|
scroll-snap-align: end;
|
|
99
|
+
cursor: pointer;
|
|
99
100
|
&:last-of-type {
|
|
100
101
|
margin-right: 0;
|
|
101
102
|
}
|
|
@@ -343,8 +343,11 @@ function (_super) {
|
|
|
343
343
|
_k.label = 1;
|
|
344
344
|
|
|
345
345
|
case 1:
|
|
346
|
-
_k.trys.push([1,
|
|
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
|
-
,
|
|
420
|
+
, 10];
|
|
409
421
|
|
|
410
|
-
case
|
|
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 =
|
|
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
|
|
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,
|
|
@@ -13,7 +13,9 @@ require("./index.less");
|
|
|
13
13
|
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
15
|
|
|
16
|
-
var _lodash =
|
|
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,
|
|
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
|
-
,
|
|
438
|
+
, 10];
|
|
425
439
|
|
|
426
|
-
case
|
|
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,
|
|
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,
|
|
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 =
|
|
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
|
|
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,
|
|
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) {
|