@fonixtree/magic-design 0.0.37 → 0.0.39
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/README.md +320 -0
- package/es/assets/fonts/magic-box-iconfont.css +11 -3
- package/es/assets/fonts/magic-box-iconfont.css.bak +11 -3
- package/es/assets/fonts/magic-box-iconfont.js +1 -1
- package/es/assets/fonts/magic-box-iconfont.js.bak +1 -1
- package/es/assets/fonts/magic-box-iconfont.ttf +0 -0
- package/es/assets/fonts/magic-box-iconfont.woff +0 -0
- package/es/assets/fonts/magic-box-iconfont.woff2 +0 -0
- package/es/assets/images/layout-icon/layout-navigation-newline.png +0 -0
- package/es/assets/images/layout-icon/layout-navigation-tile.png +0 -0
- package/es/common/FontStyles/index.js +25 -6
- package/es/common/ProductSource/index.less +2 -0
- package/es/composite-comp/common/components/ProductItem/index.js +23 -5
- package/es/composite-comp/common/components/ProductItem/index.less +46 -11
- package/es/composite-comp/common/config-panels/CustomizeConfig/index.js +21 -4
- package/es/composite-comp/dito/components/FlashDeal/mobile/index.less +6 -0
- package/es/composite-comp/dito/components/MobileNavigation/defaultJSON.js +94 -0
- package/es/composite-comp/dito/components/MobileNavigation/index.js +84 -0
- package/es/composite-comp/dito/components/MobileNavigation/mobile/index.js +129 -0
- package/es/composite-comp/dito/components/MobileNavigation/mobile/index.less +292 -0
- package/es/composite-comp/dito/components/Recommend/defaultJSON.js +95 -15
- package/es/composite-comp/dito/components/Recommend/index.js +10 -1
- package/es/composite-comp/dito/components/Recommend/mobile/index.js +214 -77
- package/es/composite-comp/dito/components/Recommend/mobile/index.less +28 -27
- package/es/composite-comp/dito/components/Recommend/pc/imgs/defImg1.png +0 -0
- package/es/composite-comp/dito/components/Recommend/pc/imgs/defImg2.png +0 -0
- package/es/composite-comp/dito/components/Recommend/pc/imgs/defImg3.png +0 -0
- package/es/composite-comp/dito/components/Recommend/pc/index.js +653 -0
- package/es/composite-comp/dito/components/Recommend/pc/index.less +80 -0
- package/es/composite-comp/dito/components/SearchBar/mobile/index.js +187 -4
- package/es/composite-comp/dito/components/SearchBar/mobile/index.less +20 -20
- package/es/composite-comp/dito/config-panels/MobileNavigationConfig/MobileNavigationConfigGroup/index.js +126 -0
- package/es/composite-comp/dito/config-panels/MobileNavigationConfig/index.js +184 -0
- package/es/composite-comp/dito/config-panels/RecommendConfig/index.js +115 -44
- package/es/composite-comp/dito/second-config-panels/MobileNavigationSecondConfig/index.js +111 -0
- package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/AIRecommendation/index.js +1 -3
- package/es/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +89 -59
- package/es/constants/component-types.js +9 -3
- package/es/constants/index.js +5 -1
- package/es/constants/layout.js +31 -3
- package/es/core/Designer/ConfigPanel/index.js +5 -1
- package/es/locale/en/en.json +8 -1
- package/es/locale/es/es.json +12 -4
- package/es/locale/id/id.json +8 -1
- package/es/meta-comp/components/Button/index.less +1 -0
- package/es/meta-comp/components/Image/image/defalut-img.png +0 -0
- package/es/meta-comp/config-panels/TextConfig/index.js +1 -0
- package/lib/assets/fonts/magic-box-iconfont.css +11 -3
- package/lib/assets/fonts/magic-box-iconfont.css.bak +11 -3
- package/lib/assets/fonts/magic-box-iconfont.js +1 -1
- package/lib/assets/fonts/magic-box-iconfont.js.bak +1 -1
- package/lib/assets/fonts/magic-box-iconfont.ttf +0 -0
- package/lib/assets/fonts/magic-box-iconfont.woff +0 -0
- package/lib/assets/fonts/magic-box-iconfont.woff2 +0 -0
- package/lib/assets/images/layout-icon/layout-navigation-newline.png +0 -0
- package/lib/assets/images/layout-icon/layout-navigation-tile.png +0 -0
- package/lib/common/FontStyles/index.js +25 -6
- package/lib/common/ProductSource/index.less +2 -0
- package/lib/composite-comp/common/components/ProductItem/index.js +23 -5
- package/lib/composite-comp/common/components/ProductItem/index.less +46 -11
- package/lib/composite-comp/common/config-panels/CustomizeConfig/index.js +21 -4
- package/lib/composite-comp/dito/components/FlashDeal/mobile/index.less +6 -0
- package/lib/composite-comp/dito/components/MobileNavigation/defaultJSON.js +94 -0
- package/lib/composite-comp/dito/components/MobileNavigation/index.js +84 -0
- package/lib/composite-comp/dito/components/MobileNavigation/mobile/index.js +129 -0
- package/lib/composite-comp/dito/components/MobileNavigation/mobile/index.less +292 -0
- package/lib/composite-comp/dito/components/Recommend/defaultJSON.js +95 -15
- package/lib/composite-comp/dito/components/Recommend/index.js +10 -1
- package/lib/composite-comp/dito/components/Recommend/mobile/index.js +214 -77
- package/lib/composite-comp/dito/components/Recommend/mobile/index.less +28 -27
- package/lib/composite-comp/dito/components/Recommend/pc/imgs/defImg1.png +0 -0
- package/lib/composite-comp/dito/components/Recommend/pc/imgs/defImg2.png +0 -0
- package/lib/composite-comp/dito/components/Recommend/pc/imgs/defImg3.png +0 -0
- package/lib/composite-comp/dito/components/Recommend/pc/index.js +653 -0
- package/lib/composite-comp/dito/components/Recommend/pc/index.less +80 -0
- package/lib/composite-comp/dito/components/SearchBar/mobile/index.js +187 -4
- package/lib/composite-comp/dito/components/SearchBar/mobile/index.less +20 -20
- package/lib/composite-comp/dito/config-panels/MobileNavigationConfig/MobileNavigationConfigGroup/index.js +126 -0
- package/lib/composite-comp/dito/config-panels/MobileNavigationConfig/index.js +184 -0
- package/lib/composite-comp/dito/config-panels/RecommendConfig/index.js +115 -44
- package/lib/composite-comp/dito/second-config-panels/MobileNavigationSecondConfig/index.js +111 -0
- package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/AIRecommendation/index.js +1 -3
- package/lib/composite-comp/dito/second-config-panels/RecommendSecondConfig/index.js +89 -59
- package/lib/constants/component-types.js +9 -3
- package/lib/constants/index.js +5 -1
- package/lib/constants/layout.js +31 -3
- package/lib/core/Designer/ConfigPanel/index.js +5 -1
- package/lib/locale/en/en.json +8 -1
- package/lib/locale/es/es.json +12 -4
- package/lib/locale/id/id.json +8 -1
- package/lib/meta-comp/components/Button/index.less +1 -0
- package/lib/meta-comp/components/Image/image/defalut-img.png +0 -0
- package/lib/meta-comp/config-panels/TextConfig/index.js +1 -0
- package/package.json +86 -1
- package/es/composite-comp/dito/config-panels/RecommendConfig/imgs/layout1.png +0 -0
- package/lib/composite-comp/dito/config-panels/RecommendConfig/imgs/layout1.png +0 -0
|
@@ -40,9 +40,9 @@ var recommendGroupSourceJSON = function recommendGroupSourceJSON(logo, text) {
|
|
|
40
40
|
text: text,
|
|
41
41
|
content: {
|
|
42
42
|
fontFamily: 'Open Sans',
|
|
43
|
-
fontWeight:
|
|
43
|
+
fontWeight: 400,
|
|
44
44
|
fontSize: 14,
|
|
45
|
-
color: '#
|
|
45
|
+
color: '#8493AF'
|
|
46
46
|
},
|
|
47
47
|
underline: {
|
|
48
48
|
open: false,
|
|
@@ -51,7 +51,52 @@ var recommendGroupSourceJSON = function recommendGroupSourceJSON(logo, text) {
|
|
|
51
51
|
},
|
|
52
52
|
vertical: {}
|
|
53
53
|
},
|
|
54
|
+
seeAll: {
|
|
55
|
+
id: (0, _uuid.v4)(),
|
|
56
|
+
open: true,
|
|
57
|
+
type: 'BUTTON',
|
|
58
|
+
text: 'See All',
|
|
59
|
+
content: {
|
|
60
|
+
url: '',
|
|
61
|
+
backgroundColor: '#fff'
|
|
62
|
+
},
|
|
63
|
+
buttonText: {
|
|
64
|
+
fontFamily: 'Open Sans',
|
|
65
|
+
fontWeight: 400,
|
|
66
|
+
fontSize: 12,
|
|
67
|
+
fontStyle: 'normal',
|
|
68
|
+
color: '#232F46'
|
|
69
|
+
},
|
|
70
|
+
buttonBorder: {
|
|
71
|
+
open: true,
|
|
72
|
+
borderColor: '',
|
|
73
|
+
borderRadius: 0
|
|
74
|
+
},
|
|
75
|
+
spacing: {
|
|
76
|
+
pc: {
|
|
77
|
+
paddingTop: 0,
|
|
78
|
+
paddingBottom: 0,
|
|
79
|
+
paddingLeft: 0,
|
|
80
|
+
paddingRight: 0
|
|
81
|
+
},
|
|
82
|
+
mobile: {
|
|
83
|
+
paddingTop: 0,
|
|
84
|
+
paddingBottom: 0,
|
|
85
|
+
paddingLeft: 0,
|
|
86
|
+
paddingRight: 0
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
buttonIcon: {
|
|
90
|
+
iconUrl: '/get/resource/platform/conf/20220923/picture/Frame24271573200432656932864.png',
|
|
91
|
+
layout: 'left'
|
|
92
|
+
},
|
|
93
|
+
hover: null
|
|
94
|
+
},
|
|
54
95
|
sourceType: 'recommend',
|
|
96
|
+
prodIds: '',
|
|
97
|
+
intelligentType: '',
|
|
98
|
+
intelligentValue: [],
|
|
99
|
+
maxProdNum: 10,
|
|
55
100
|
hover: {
|
|
56
101
|
open: true,
|
|
57
102
|
image: {
|
|
@@ -83,7 +128,7 @@ var recommendGroupSourceJSON = function recommendGroupSourceJSON(logo, text) {
|
|
|
83
128
|
text: text,
|
|
84
129
|
content: {
|
|
85
130
|
fontFamily: 'Open Sans',
|
|
86
|
-
fontWeight:
|
|
131
|
+
fontWeight: 600,
|
|
87
132
|
fontSize: 14,
|
|
88
133
|
color: '#CE1126'
|
|
89
134
|
},
|
|
@@ -104,7 +149,7 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
104
149
|
return {
|
|
105
150
|
id: (0, _uuid.v4)(),
|
|
106
151
|
type: 'RECOMMEND',
|
|
107
|
-
groupSource: [recommendGroupSourceJSON('', '
|
|
152
|
+
groupSource: [recommendGroupSourceJSON('', 'Tab1'), recommendGroupSourceJSON('', 'Tab2')],
|
|
108
153
|
content: {
|
|
109
154
|
label: {
|
|
110
155
|
id: (0, _uuid.v4)(),
|
|
@@ -113,20 +158,33 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
113
158
|
text: 'Button',
|
|
114
159
|
content: {
|
|
115
160
|
url: '',
|
|
116
|
-
backgroundColor: '#
|
|
161
|
+
backgroundColor: '#CE1126'
|
|
117
162
|
},
|
|
118
163
|
buttonText: {
|
|
119
164
|
fontFamily: 'Open Sans',
|
|
120
165
|
fontWeight: 600,
|
|
121
166
|
fontSize: 8,
|
|
122
167
|
fontStyle: 'normal',
|
|
123
|
-
color: '#fff'
|
|
124
|
-
padding: '0 5px'
|
|
168
|
+
color: '#fff'
|
|
125
169
|
},
|
|
126
170
|
buttonBorder: {
|
|
127
171
|
open: true,
|
|
128
172
|
borderColor: '',
|
|
129
|
-
borderRadius:
|
|
173
|
+
borderRadius: 0
|
|
174
|
+
},
|
|
175
|
+
spacing: {
|
|
176
|
+
pc: {
|
|
177
|
+
paddingTop: 0,
|
|
178
|
+
paddingBottom: 0,
|
|
179
|
+
paddingLeft: 5,
|
|
180
|
+
paddingRight: 5
|
|
181
|
+
},
|
|
182
|
+
mobile: {
|
|
183
|
+
paddingTop: 0,
|
|
184
|
+
paddingBottom: 0,
|
|
185
|
+
paddingLeft: 5,
|
|
186
|
+
paddingRight: 5
|
|
187
|
+
}
|
|
130
188
|
},
|
|
131
189
|
buttonIcon: {
|
|
132
190
|
iconUrl: '',
|
|
@@ -142,9 +200,9 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
142
200
|
text: 'Flash Deal',
|
|
143
201
|
content: {
|
|
144
202
|
fontFamily: 'Open Sans',
|
|
145
|
-
fontWeight:
|
|
203
|
+
fontWeight: 700,
|
|
146
204
|
fontSize: 14,
|
|
147
|
-
color: '#
|
|
205
|
+
color: '#232F46'
|
|
148
206
|
},
|
|
149
207
|
underline: {
|
|
150
208
|
open: false,
|
|
@@ -164,7 +222,7 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
164
222
|
text: 'Flash Deal',
|
|
165
223
|
content: {
|
|
166
224
|
fontFamily: 'Open Sans',
|
|
167
|
-
fontWeight:
|
|
225
|
+
fontWeight: 700,
|
|
168
226
|
fontSize: 14,
|
|
169
227
|
color: '#CE1126'
|
|
170
228
|
},
|
|
@@ -188,7 +246,7 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
188
246
|
fontFamily: 'Open Sans',
|
|
189
247
|
fontWeight: 500,
|
|
190
248
|
fontSize: 10,
|
|
191
|
-
color: '#
|
|
249
|
+
color: '#8493AF'
|
|
192
250
|
},
|
|
193
251
|
underline: {
|
|
194
252
|
open: false,
|
|
@@ -204,13 +262,35 @@ var getDefaultJSON = function getDefaultJSON() {
|
|
|
204
262
|
open: true
|
|
205
263
|
}
|
|
206
264
|
},
|
|
265
|
+
spacing: {
|
|
266
|
+
pc: {
|
|
267
|
+
paddingTop: 0,
|
|
268
|
+
paddingBottom: 0,
|
|
269
|
+
paddingLeft: 0,
|
|
270
|
+
paddingRight: 0,
|
|
271
|
+
marginBottom: 0
|
|
272
|
+
},
|
|
273
|
+
mobile: {
|
|
274
|
+
paddingTop: 0,
|
|
275
|
+
paddingBottom: 0,
|
|
276
|
+
paddingLeft: 0,
|
|
277
|
+
paddingRight: 0,
|
|
278
|
+
marginBottom: 0
|
|
279
|
+
}
|
|
280
|
+
},
|
|
207
281
|
customize: {
|
|
208
|
-
layout:
|
|
209
|
-
|
|
282
|
+
layout: {
|
|
283
|
+
pcLayout: 'layout1',
|
|
284
|
+
h5Layout: 'layout1'
|
|
285
|
+
},
|
|
286
|
+
align: 'left',
|
|
287
|
+
pcRowNum: 6,
|
|
288
|
+
pcMaxRowNum: 6,
|
|
289
|
+
pcMinRowNum: 5
|
|
210
290
|
},
|
|
211
291
|
background: {
|
|
212
292
|
opacity: 100,
|
|
213
|
-
color: '#
|
|
293
|
+
color: '#fff',
|
|
214
294
|
image: '',
|
|
215
295
|
bgType: 'color'
|
|
216
296
|
}
|
|
@@ -9,12 +9,16 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _mobile = _interopRequireDefault(require("./mobile"));
|
|
11
11
|
|
|
12
|
+
var _pc = _interopRequireDefault(require("./pc"));
|
|
13
|
+
|
|
12
14
|
var _defaultJSON = require("./defaultJSON");
|
|
13
15
|
|
|
14
16
|
var _coreUtil = require("../../../../utils/coreUtil");
|
|
15
17
|
|
|
16
18
|
var _compositeDecorator = _interopRequireDefault(require("../../../../decorator/compositeDecorator"));
|
|
17
19
|
|
|
20
|
+
var _businessUtil = require("../../../../utils/businessUtil");
|
|
21
|
+
|
|
18
22
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
19
23
|
|
|
20
24
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
@@ -70,7 +74,12 @@ function (_super) {
|
|
|
70
74
|
|
|
71
75
|
Recommend.prototype.render = function () {
|
|
72
76
|
var nodeData = this.props.nodeData;
|
|
73
|
-
|
|
77
|
+
var wrapStyle = (0, _businessUtil.computeStyle)(nodeData, window.magicDesign.device);
|
|
78
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
79
|
+
style: wrapStyle
|
|
80
|
+
}, (0, _coreUtil.isPc)() ? /*#__PURE__*/_react["default"].createElement(_pc["default"], {
|
|
81
|
+
panelProps: nodeData
|
|
82
|
+
}) : /*#__PURE__*/_react["default"].createElement(_mobile["default"], {
|
|
74
83
|
panelProps: nodeData
|
|
75
84
|
}));
|
|
76
85
|
};
|
|
@@ -11,6 +11,8 @@ var _macy = _interopRequireDefault(require("macy"));
|
|
|
11
11
|
|
|
12
12
|
require("./index.less");
|
|
13
13
|
|
|
14
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
|
+
|
|
14
16
|
var _mobx = require("../../../../../mobx");
|
|
15
17
|
|
|
16
18
|
var _ProductItem = _interopRequireDefault(require("../../../../common/components/ProductItem"));
|
|
@@ -224,6 +226,29 @@ var __spreadArrays = void 0 && (void 0).__spreadArrays || function () {
|
|
|
224
226
|
return r;
|
|
225
227
|
};
|
|
226
228
|
|
|
229
|
+
var LAYOUT_IMAGE_SIZE = {
|
|
230
|
+
layout1: {
|
|
231
|
+
w: '100%',
|
|
232
|
+
h: 164
|
|
233
|
+
},
|
|
234
|
+
layout2: {
|
|
235
|
+
w: 100,
|
|
236
|
+
h: '100%'
|
|
237
|
+
},
|
|
238
|
+
layout3: {
|
|
239
|
+
w: '100%',
|
|
240
|
+
h: 104
|
|
241
|
+
},
|
|
242
|
+
layout4: {
|
|
243
|
+
w: 96,
|
|
244
|
+
h: 96
|
|
245
|
+
},
|
|
246
|
+
layout5: {
|
|
247
|
+
w: 110,
|
|
248
|
+
h: 110
|
|
249
|
+
}
|
|
250
|
+
};
|
|
251
|
+
|
|
227
252
|
var RecommendMobile =
|
|
228
253
|
/** @class */
|
|
229
254
|
function (_super) {
|
|
@@ -233,15 +258,34 @@ function (_super) {
|
|
|
233
258
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
|
234
259
|
|
|
235
260
|
_this.preData = {};
|
|
261
|
+
_this.preLayout = '';
|
|
236
262
|
_this._cache = (0, _coreUtil.isDesignMode)() ? {} : (0, _commonUtil.ensure)(function () {
|
|
237
263
|
return (0, _storeUtil.getMagicStore)("recommend_" + _this.props.panelProps.id);
|
|
238
264
|
}, {});
|
|
239
265
|
_this.state = __assign({
|
|
240
266
|
tabIndex: 0,
|
|
241
267
|
tabLeft: 0,
|
|
242
|
-
tabWidth: 0
|
|
268
|
+
tabWidth: 0,
|
|
269
|
+
groupSource: [],
|
|
270
|
+
hideTabs: false
|
|
243
271
|
}, _this._cache);
|
|
244
272
|
|
|
273
|
+
_this.initTab = function (index, hideTabs) {
|
|
274
|
+
var selectedTabDom = document.querySelector(".tab-select-wrap .tabTitle:nth-child(" + (index + 1) + ")");
|
|
275
|
+
var tabLeft = 0;
|
|
276
|
+
var tabWidth = 0;
|
|
277
|
+
|
|
278
|
+
if (selectedTabDom && !hideTabs) {
|
|
279
|
+
tabLeft = selectedTabDom.offsetLeft;
|
|
280
|
+
tabWidth = selectedTabDom.offsetWidth;
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
_this.setState({
|
|
284
|
+
tabLeft: tabLeft,
|
|
285
|
+
tabWidth: tabWidth
|
|
286
|
+
});
|
|
287
|
+
};
|
|
288
|
+
|
|
245
289
|
_this.getTabBarActiveColor = function (_panelProps) {
|
|
246
290
|
var tabIndex = _this.state.tabIndex;
|
|
247
291
|
return (0, _commonUtil.ensure)(function () {
|
|
@@ -251,24 +295,26 @@ function (_super) {
|
|
|
251
295
|
|
|
252
296
|
_this.getProductList = function (index) {
|
|
253
297
|
return __awaiter(_this, void 0, void 0, function () {
|
|
254
|
-
var recommendId, cache, sourceType,
|
|
298
|
+
var panelProps, groupSource, recommendId, cache, _a, _b, sourceType, _c, prodIds, _d, intelligentType, _e, intelligentValue, _f, maxProdNum, newData, res, res, e_1, _cache;
|
|
255
299
|
|
|
256
|
-
var
|
|
300
|
+
var _g, _h, _j;
|
|
257
301
|
|
|
258
302
|
var _this = this;
|
|
259
303
|
|
|
260
|
-
return __generator(this, function (
|
|
261
|
-
switch (
|
|
304
|
+
return __generator(this, function (_k) {
|
|
305
|
+
switch (_k.label) {
|
|
262
306
|
case 0:
|
|
263
|
-
|
|
307
|
+
panelProps = this.props.panelProps;
|
|
308
|
+
groupSource = this.state.groupSource;
|
|
309
|
+
recommendId = panelProps.id;
|
|
264
310
|
|
|
265
311
|
if (!(0, _coreUtil.isDesignMode)()) {
|
|
266
312
|
cache = (0, _storeUtil.getMagicStore)("recommend_" + recommendId);
|
|
267
313
|
|
|
268
314
|
if (cache) {
|
|
269
315
|
if ("products" + index in cache) {
|
|
270
|
-
this.setState((
|
|
271
|
-
_this.
|
|
316
|
+
this.setState((_g = {}, _g["products" + index] = cache["products" + index], _g), function () {
|
|
317
|
+
_this.resetLayout();
|
|
272
318
|
});
|
|
273
319
|
/** 如果数据未过期 */
|
|
274
320
|
|
|
@@ -279,23 +325,18 @@ function (_super) {
|
|
|
279
325
|
}
|
|
280
326
|
}
|
|
281
327
|
|
|
282
|
-
sourceType =
|
|
283
|
-
return _this.props.panelProps.groupSource[index].sourceType;
|
|
284
|
-
}, 'recommend');
|
|
285
|
-
ids = (0, _commonUtil.ensure)(function () {
|
|
286
|
-
return _this.props.panelProps.groupSource[index].prodIds;
|
|
287
|
-
}, '');
|
|
328
|
+
_a = groupSource[index] || {}, _b = _a.sourceType, sourceType = _b === void 0 ? '' : _b, _c = _a.prodIds, prodIds = _c === void 0 ? '' : _c, _d = _a.intelligentType, intelligentType = _d === void 0 ? '' : _d, _e = _a.intelligentValue, intelligentValue = _e === void 0 ? [] : _e, _f = _a.maxProdNum, maxProdNum = _f === void 0 ? 10 : _f;
|
|
288
329
|
newData = [];
|
|
289
|
-
|
|
330
|
+
_k.label = 1;
|
|
290
331
|
|
|
291
332
|
case 1:
|
|
292
|
-
|
|
333
|
+
_k.trys.push([1, 7,, 8]);
|
|
293
334
|
|
|
294
335
|
if (!(sourceType === 'select')) return [3
|
|
295
336
|
/*break*/
|
|
296
337
|
, 3];
|
|
297
338
|
|
|
298
|
-
if (!
|
|
339
|
+
if (!prodIds) {
|
|
299
340
|
return [2
|
|
300
341
|
/*return*/
|
|
301
342
|
];
|
|
@@ -304,54 +345,63 @@ function (_super) {
|
|
|
304
345
|
return [4
|
|
305
346
|
/*yield*/
|
|
306
347
|
, (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/products", {
|
|
307
|
-
products:
|
|
348
|
+
products: prodIds,
|
|
308
349
|
state: 'A'
|
|
309
350
|
}, 'GET')];
|
|
310
351
|
|
|
311
352
|
case 2:
|
|
312
|
-
res =
|
|
353
|
+
res = _k.sent();
|
|
313
354
|
newData = __spreadArrays(res.list);
|
|
314
355
|
return [3
|
|
315
356
|
/*break*/
|
|
316
|
-
,
|
|
357
|
+
, 6];
|
|
317
358
|
|
|
318
359
|
case 3:
|
|
360
|
+
if (!(sourceType === 'recommend')) return [3
|
|
361
|
+
/*break*/
|
|
362
|
+
, 5];
|
|
319
363
|
return [4
|
|
320
364
|
/*yield*/
|
|
321
365
|
, (0, _commonUtil.commonFetch)(window.magicDesign.MBaseUrl + "/h5/offers", {
|
|
322
366
|
pageIndex: 1,
|
|
323
|
-
pageSize:
|
|
367
|
+
pageSize: maxProdNum,
|
|
324
368
|
sortType: '1',
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
369
|
+
intelligentType: intelligentType,
|
|
370
|
+
intelligentValue: intelligentValue.join(','),
|
|
371
|
+
aggregation: false
|
|
328
372
|
}, 'POST')];
|
|
329
373
|
|
|
330
374
|
case 4:
|
|
331
|
-
res =
|
|
375
|
+
res = _k.sent();
|
|
332
376
|
newData = __spreadArrays(res.pageInfo.list);
|
|
333
|
-
|
|
377
|
+
return [3
|
|
378
|
+
/*break*/
|
|
379
|
+
, 6];
|
|
334
380
|
|
|
335
381
|
case 5:
|
|
382
|
+
newData = [];
|
|
383
|
+
_k.label = 6;
|
|
384
|
+
|
|
385
|
+
case 6:
|
|
336
386
|
return [3
|
|
337
387
|
/*break*/
|
|
338
|
-
,
|
|
388
|
+
, 8];
|
|
339
389
|
|
|
340
|
-
case
|
|
341
|
-
e_1 =
|
|
390
|
+
case 7:
|
|
391
|
+
e_1 = _k.sent();
|
|
342
392
|
newData = [];
|
|
343
393
|
return [3
|
|
344
394
|
/*break*/
|
|
345
|
-
,
|
|
395
|
+
, 8];
|
|
346
396
|
|
|
347
|
-
case
|
|
397
|
+
case 8:
|
|
348
398
|
if (!(0, _coreUtil.isDesignMode)()) {
|
|
349
399
|
_cache = (0, _storeUtil.getMagicStore)("recommend_" + recommendId);
|
|
350
|
-
(0, _storeUtil.setMagicStore)("recommend_" + recommendId, __assign(__assign({}, _cache), (
|
|
400
|
+
(0, _storeUtil.setMagicStore)("recommend_" + recommendId, __assign(__assign({}, _cache), (_h = {}, _h["products" + index] = newData, _h.endTime = Date.now() + 3 * 60 * 1000, _h)));
|
|
351
401
|
}
|
|
352
402
|
|
|
353
|
-
this.setState((
|
|
354
|
-
_this.
|
|
403
|
+
this.setState((_j = {}, _j["products" + index] = newData, _j), function () {
|
|
404
|
+
_this.resetLayout();
|
|
355
405
|
});
|
|
356
406
|
return [2
|
|
357
407
|
/*return*/
|
|
@@ -361,7 +411,22 @@ function (_super) {
|
|
|
361
411
|
});
|
|
362
412
|
};
|
|
363
413
|
|
|
364
|
-
_this.
|
|
414
|
+
_this.resetLayout = function () {
|
|
415
|
+
var layout = _this.props.panelProps.customize.layout.h5Layout;
|
|
416
|
+
var LAYOUT_COLUMN = {
|
|
417
|
+
layout1: 2,
|
|
418
|
+
layout2: 1,
|
|
419
|
+
layout3: 3
|
|
420
|
+
};
|
|
421
|
+
if (!LAYOUT_COLUMN[layout]) return;
|
|
422
|
+
setTimeout(function () {
|
|
423
|
+
if (document.querySelector('.macyContainer')) {
|
|
424
|
+
_this.getMacy('.macyContainer', LAYOUT_COLUMN[layout]);
|
|
425
|
+
}
|
|
426
|
+
});
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
_this.getMacy = function (container, columns) {
|
|
365
430
|
var masonryNew = new _macy["default"]({
|
|
366
431
|
container: container,
|
|
367
432
|
trueOrder: false,
|
|
@@ -371,29 +436,13 @@ function (_super) {
|
|
|
371
436
|
x: 12,
|
|
372
437
|
y: 12
|
|
373
438
|
},
|
|
374
|
-
columns:
|
|
439
|
+
columns: columns
|
|
375
440
|
});
|
|
376
441
|
masonryNew.runOnImageLoad(function () {
|
|
377
442
|
masonryNew.recalculate(true);
|
|
378
443
|
}, true);
|
|
379
444
|
};
|
|
380
445
|
|
|
381
|
-
_this.onTabChange = function (tabIndex) {
|
|
382
|
-
var _a;
|
|
383
|
-
|
|
384
|
-
var panelProps = _this.props.panelProps;
|
|
385
|
-
if (tabIndex === _this.state.tabIndex) return;
|
|
386
|
-
|
|
387
|
-
_this.setState((_a = {
|
|
388
|
-
tabIndex: tabIndex
|
|
389
|
-
}, _a["products" + tabIndex] = [], _a));
|
|
390
|
-
|
|
391
|
-
var curTab = panelProps.groupSource[tabIndex];
|
|
392
|
-
if (curTab.prodIds === '') return;
|
|
393
|
-
|
|
394
|
-
_this.getProductList(tabIndex);
|
|
395
|
-
};
|
|
396
|
-
|
|
397
446
|
_this.getBackgroundStyle = function () {
|
|
398
447
|
var panelProps = _this.props.panelProps;
|
|
399
448
|
var bgStyle = {};
|
|
@@ -413,46 +462,88 @@ function (_super) {
|
|
|
413
462
|
};
|
|
414
463
|
|
|
415
464
|
_this.onTabClick = function (e, index) {
|
|
416
|
-
var
|
|
417
|
-
|
|
465
|
+
var tabIndex = _this.state.tabIndex;
|
|
466
|
+
if (tabIndex === index) return;
|
|
418
467
|
e.currentTarget.scrollIntoView(false);
|
|
419
468
|
|
|
420
|
-
_this.getProductList(index);
|
|
421
|
-
|
|
422
469
|
_this.setState({
|
|
423
|
-
tabLeft: tabLeft,
|
|
424
|
-
tabWidth: tabWidth,
|
|
425
470
|
tabIndex: index
|
|
426
471
|
}, function () {
|
|
427
|
-
_this.
|
|
472
|
+
_this.resetLayout();
|
|
473
|
+
|
|
474
|
+
_this.initTab(index);
|
|
428
475
|
});
|
|
476
|
+
|
|
477
|
+
_this.getProductList(index);
|
|
429
478
|
};
|
|
430
479
|
|
|
431
480
|
return _this;
|
|
432
481
|
}
|
|
433
482
|
|
|
434
483
|
RecommendMobile.prototype.componentDidMount = function () {
|
|
435
|
-
var
|
|
436
|
-
|
|
437
|
-
var
|
|
438
|
-
var
|
|
439
|
-
|
|
484
|
+
var _this = this;
|
|
485
|
+
|
|
486
|
+
var panelProps = this.props.panelProps;
|
|
487
|
+
var source = [];
|
|
488
|
+
panelProps.groupSource.map(function (m) {
|
|
489
|
+
var show = m.image.open || m.groupName.open;
|
|
490
|
+
if (show) source.push(m);
|
|
491
|
+
});
|
|
440
492
|
this.setState({
|
|
441
|
-
|
|
442
|
-
|
|
493
|
+
groupSource: source
|
|
494
|
+
}, function () {
|
|
495
|
+
_this.initTab(0);
|
|
496
|
+
|
|
497
|
+
_this.getProductList(0);
|
|
443
498
|
});
|
|
444
499
|
};
|
|
445
500
|
|
|
446
501
|
RecommendMobile.prototype.componentWillReceiveProps = function () {
|
|
502
|
+
var _this = this;
|
|
503
|
+
|
|
447
504
|
var tabIndex = this.state.tabIndex;
|
|
448
|
-
var
|
|
505
|
+
var panelProps = this.props.panelProps;
|
|
506
|
+
var source = [];
|
|
507
|
+
var hideTabs = false;
|
|
508
|
+
panelProps.groupSource.map(function (m) {
|
|
509
|
+
var show = m.image.open || m.groupName.open;
|
|
510
|
+
if (show) source.push(m);
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
if (source.length === 0 && panelProps.groupSource.length > 0) {
|
|
514
|
+
source.push(panelProps.groupSource[0]);
|
|
515
|
+
hideTabs = true;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
this.setState({
|
|
519
|
+
groupSource: source
|
|
520
|
+
}, function () {
|
|
521
|
+
var groupSource = _this.state.groupSource;
|
|
522
|
+
|
|
523
|
+
if (JSON.stringify(groupSource) === _this.preData) {
|
|
524
|
+
return;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
_this.preData = JSON.stringify(groupSource);
|
|
528
|
+
var newTabIndex = tabIndex;
|
|
529
|
+
if (tabIndex >= source.length) newTabIndex = 0;
|
|
530
|
+
|
|
531
|
+
_this.initTab(newTabIndex, hideTabs);
|
|
532
|
+
|
|
533
|
+
_this.getProductList(newTabIndex);
|
|
534
|
+
|
|
535
|
+
_this.setState({
|
|
536
|
+
tabIndex: newTabIndex,
|
|
537
|
+
hideTabs: hideTabs
|
|
538
|
+
});
|
|
539
|
+
});
|
|
540
|
+
var curLayout = panelProps.customize.layout.h5Layout;
|
|
449
541
|
|
|
450
|
-
if (
|
|
451
|
-
|
|
542
|
+
if (curLayout !== this.preLayout) {
|
|
543
|
+
this.resetLayout();
|
|
452
544
|
}
|
|
453
545
|
|
|
454
|
-
this.
|
|
455
|
-
this.getProductList(tabIndex);
|
|
546
|
+
this.preLayout = curLayout;
|
|
456
547
|
};
|
|
457
548
|
|
|
458
549
|
RecommendMobile.prototype.render = function () {
|
|
@@ -462,21 +553,36 @@ function (_super) {
|
|
|
462
553
|
var _a = this.state,
|
|
463
554
|
tabIndex = _a.tabIndex,
|
|
464
555
|
tabLeft = _a.tabLeft,
|
|
465
|
-
tabWidth = _a.tabWidth
|
|
556
|
+
tabWidth = _a.tabWidth,
|
|
557
|
+
groupSource = _a.groupSource,
|
|
558
|
+
hideTabs = _a.hideTabs;
|
|
466
559
|
var bgStyle = this.getBackgroundStyle();
|
|
467
560
|
var products = this.state["products" + tabIndex] || [];
|
|
468
|
-
var isDivide =
|
|
561
|
+
var isDivide = groupSource.length <= 3;
|
|
562
|
+
var layout = panelProps.customize.layout.h5Layout;
|
|
563
|
+
|
|
564
|
+
var _seeAll = (0, _commonUtil.ensure)(function () {
|
|
565
|
+
return groupSource[tabIndex].seeAll;
|
|
566
|
+
}, '');
|
|
567
|
+
|
|
568
|
+
var imgHeight = (0, _commonUtil.ensure)(function () {
|
|
569
|
+
return LAYOUT_IMAGE_SIZE[layout].h;
|
|
570
|
+
}, 140);
|
|
571
|
+
var imgWidth = (0, _commonUtil.ensure)(function () {
|
|
572
|
+
return LAYOUT_IMAGE_SIZE[layout].w;
|
|
573
|
+
}, 140);
|
|
469
574
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
470
575
|
className: "m-recommend-mobile",
|
|
471
576
|
style: bgStyle
|
|
472
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
577
|
+
}, !hideTabs && /*#__PURE__*/_react["default"].createElement("div", {
|
|
473
578
|
className: "tab-select-wrap"
|
|
474
|
-
},
|
|
579
|
+
}, groupSource.map(function (tab, index) {
|
|
475
580
|
var _image = index == tabIndex && tab.hover.open && tab.hover.image.open ? tab.hover.image : tab.image;
|
|
476
581
|
|
|
477
582
|
var _groupName = index == tabIndex && tab.hover.open && tab.hover.groupName.open ? tab.hover.groupName : tab.groupName;
|
|
478
583
|
|
|
479
584
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
585
|
+
key: tab.id,
|
|
480
586
|
className: "tabTitle",
|
|
481
587
|
onClick: function onClick(e) {
|
|
482
588
|
_this.onTabClick(e, index);
|
|
@@ -505,18 +611,49 @@ function (_super) {
|
|
|
505
611
|
transform: "translateX(" + tabLeft + "px)",
|
|
506
612
|
background: this.getTabBarActiveColor(panelProps)
|
|
507
613
|
}
|
|
508
|
-
})), /*#__PURE__*/_react["default"].createElement("div", {
|
|
509
|
-
|
|
614
|
+
})), ['layout1', 'layout2', 'layout3'].includes(layout) ? /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement("div", {
|
|
615
|
+
key: "macyContainer",
|
|
616
|
+
className: "macyContainer"
|
|
510
617
|
}, products.map(function (item) {
|
|
511
618
|
return /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
|
|
512
619
|
key: item.productId,
|
|
513
620
|
data: item,
|
|
621
|
+
fixHeight: layout === 'layout3',
|
|
622
|
+
imgHeight: imgHeight,
|
|
623
|
+
imgWidth: imgWidth,
|
|
624
|
+
layout: layout === 'layout2' ? 'horizontal' : 'vertical',
|
|
514
625
|
onItemClick: function onItemClick() {
|
|
515
626
|
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId + "?productId=" + (item.sppProductId || item.productId || ''));
|
|
516
627
|
},
|
|
517
628
|
panelProps: panelProps.content,
|
|
518
629
|
showProgress: false
|
|
519
630
|
});
|
|
631
|
+
})), _seeAll.open && products.length > 0 && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
632
|
+
className: "btnSeeAll",
|
|
633
|
+
data: _seeAll
|
|
634
|
+
})) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
635
|
+
key: "scrollContainer",
|
|
636
|
+
className: (0, _classnames["default"])('scrollContainer', {
|
|
637
|
+
pl_100: layout === 'layout5'
|
|
638
|
+
})
|
|
639
|
+
}, products.map(function (item) {
|
|
640
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
641
|
+
className: "productCard"
|
|
642
|
+
}, /*#__PURE__*/_react["default"].createElement(_ProductItem["default"], {
|
|
643
|
+
key: "scroll_" + item.productId,
|
|
644
|
+
data: item,
|
|
645
|
+
fixHeight: true,
|
|
646
|
+
imgHeight: imgHeight,
|
|
647
|
+
imgWidth: imgWidth,
|
|
648
|
+
onItemClick: function onItemClick() {
|
|
649
|
+
return (0, _coreUtil.clickUrl)("/product/detail/" + item.offerId + "?productId=" + (item.sppProductId || item.productId || ''));
|
|
650
|
+
},
|
|
651
|
+
panelProps: panelProps.content,
|
|
652
|
+
showProgress: false
|
|
653
|
+
}));
|
|
654
|
+
}), _seeAll.open && products.length > 0 && /*#__PURE__*/_react["default"].createElement(_components.MetaButton, {
|
|
655
|
+
className: "btnSeeAll",
|
|
656
|
+
data: _seeAll
|
|
520
657
|
})));
|
|
521
658
|
};
|
|
522
659
|
|