@conecli/cone-render 0.8.20-shop.176 → 0.8.20-shop.177
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
1
|
NETWORK_DATA_TYPE,
|
|
3
2
|
M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
4
3
|
APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
5
4
|
containerFloorListData: ComponentInterFace.ContainerItemData[];
|
|
6
5
|
className?: string;
|
|
7
6
|
containerItemClass?: object;
|
|
8
7
|
style?: object;
|
|
9
8
|
hasGoodsFeeds?: boolean;
|
|
10
9
|
builtInComponents?: object;
|
|
11
10
|
loadingEndComponentFn?: functionType;
|
|
12
11
|
sectionType?: string;
|
|
13
12
|
updateShopFloorDataFn?: functionType;
|
|
14
13
|
updateContainerFloorListDataFn?: functionType;
|
|
15
14
|
refreshFloorListDataFn?: functionType;
|
|
16
15
|
refreshFloorListDataBtnLabel?: string;
|
|
17
16
|
customErrorIsvFloorModule?: React.ReactElement;
|
|
18
17
|
componentExtend?: React.ReactElement;
|
|
19
18
|
luxuryFixedIndex?: number;
|
|
20
19
|
isContainerListHasMarginBottom?: boolean;
|
|
21
20
|
const { windowHeight } = taroJdBaseInfo.info.sysInfo;
|
|
22
21
|
const {
|
|
23
22
|
className,
|
|
24
23
|
style,
|
|
25
24
|
containerItemClass = null,
|
|
26
25
|
containerFloorListData,
|
|
27
26
|
builtInComponents,
|
|
28
27
|
loadingEndComponentFn,
|
|
29
28
|
sectionType,
|
|
30
29
|
updateShopFloorDataFn,
|
|
31
30
|
updateContainerFloorListDataFn,
|
|
32
31
|
refreshFloorListDataFn,
|
|
33
32
|
refreshFloorListDataBtnLabel,
|
|
34
33
|
customErrorIsvFloorModule,
|
|
35
34
|
luxuryFixedIndex = -1,
|
|
36
35
|
isContainerListHasMarginBottom,
|
|
37
36
|
} = props;
|
|
38
37
|
const isSageShop = taroJdBaseInfo.info?.pageInfo?.isSageShop
|
|
39
38
|
const isHasMarginBottom = isContainerListHasMarginBottom ?? !isSageShop
|
|
40
39
|
|
|
41
40
|
const hasLiveForSageShop =
|
|
42
41
|
isSageShop && taroJdBaseInfo.info?.pageInfo?.isJdShowNativeImmersivePlayer;
|
|
43
42
|
|
|
44
43
|
const renderFloorItem = (
|
|
45
44
|
item,
|
|
46
45
|
floorItem,
|
|
47
46
|
floorIndex,
|
|
48
47
|
containerLayoutLeftRightMargin,
|
|
49
48
|
lazyLoadState = false,
|
|
50
49
|
index,
|
|
51
50
|
borderStyle,
|
|
52
51
|
) => {
|
|
53
52
|
return (
|
|
54
53
|
<View
|
|
55
54
|
className={classNames(shopContainerListStyle['d-floor-item'])}
|
|
56
55
|
data-floor-uid={floorItem?.uid}
|
|
57
56
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
58
57
|
data-lazy-load={lazyLoadState}
|
|
59
58
|
key={floorItem.uid}
|
|
60
59
|
id={`J_floor_${floorItem.uid}`}
|
|
61
60
|
style={borderStyle}
|
|
62
61
|
>
|
|
63
62
|
{isChartH5 && (
|
|
64
63
|
<View
|
|
65
64
|
className={shopContainerListStyle['d-floor-chart-item']}
|
|
66
65
|
id={`J_chart_floor_${floorItem?.uid}`}
|
|
67
66
|
data-floor-uid={floorItem?.uid}
|
|
68
67
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
69
68
|
/>
|
|
70
69
|
)}
|
|
71
70
|
<FloorListItem
|
|
72
71
|
floorIndex={floorIndex}
|
|
73
72
|
floorData={floorItem}
|
|
74
73
|
layoutLeftRightMargin={containerLayoutLeftRightMargin}
|
|
75
74
|
containerBorderRadius={borderStyle}
|
|
76
75
|
updateShopFloorDataFn={updateShopFloorDataFn}
|
|
77
76
|
loadingEndComponentFn={loadingEndComponentFn}
|
|
78
77
|
key={floorItem.uid}
|
|
79
78
|
builtInComponents={builtInComponents}
|
|
80
79
|
updateContainerFloorListDataFn={updateContainerFloorListDataFn}
|
|
81
80
|
customErrorIsvFloorModule={customErrorIsvFloorModule}
|
|
82
81
|
/>
|
|
83
82
|
{index === luxuryFixedIndex ? props.children : null}
|
|
84
83
|
</View>
|
|
85
84
|
);
|
|
86
85
|
};
|
|
87
86
|
|
|
88
87
|
const getFloorSetHeight = (item) => {
|
|
89
88
|
const getHeight = item?.floorExtInfo?.floorHeight
|
|
90
89
|
? Number(item?.floorExtInfo?.floorHeight)
|
|
91
90
|
: 200;
|
|
92
91
|
return getHeight > 0 ? getHeight : 200;
|
|
93
92
|
};
|
|
94
93
|
const containerFloorListDataLen = containerFloorListData.length;
|
|
95
94
|
|
|
96
95
|
const getNoDataContainerHeight = () => {
|
|
97
96
|
const changeHeight = hasLiveForSageShop
|
|
98
97
|
? windowHeight
|
|
99
98
|
: windowHeight -
|
|
100
99
|
(isJdApp
|
|
101
100
|
? APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT
|
|
102
101
|
: M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT);
|
|
103
102
|
return {
|
|
104
103
|
height: `${changeHeight}px`,
|
|
105
104
|
};
|
|
106
105
|
};
|
|
107
106
|
return (
|
|
108
107
|
<View
|
|
109
108
|
className={classNames(className, shopContainerListStyle['d-shop-container-list'])}
|
|
110
109
|
style={style}
|
|
111
110
|
>
|
|
112
111
|
<View id="J_shopContainerFloorList"
|
|
113
112
|
className={
|
|
114
113
|
isHasMarginBottom ? shopContainerListStyle['d-container-list-with-margin-bottom'] : shopContainerListStyle['d-container-list-no-margin-bottom']
|
|
115
114
|
}
|
|
116
115
|
>
|
|
117
116
|
{containerFloorListDataLen > 0 ? (
|
|
118
117
|
containerFloorListData.map((item, index) => {
|
|
119
118
|
const containerLayoutLeftRightMargin = (item.marginLeft || 0) + (item.marginRight || 0);
|
|
120
119
|
const getContainerId = `J_container_${item.containerId}`;
|
|
121
120
|
const borderStyle = getBorderStyle(
|
|
122
121
|
item,
|
|
123
122
|
index,
|
|
124
123
|
containerFloorListData,
|
|
125
124
|
containerFloorListDataLen,
|
|
126
125
|
);
|
|
127
126
|
return (
|
|
128
127
|
<React.Fragment key={item.containerId + index}>
|
|
129
128
|
{item.addLuxuryStyle ? (
|
|
130
129
|
<View className={shopContainerListStyle['d-luxury-header']} />
|
|
131
130
|
) : null}
|
|
132
131
|
{item.addLuxuryBackupStyle ? (
|
|
133
132
|
<View
|
|
134
133
|
style={{
|
|
135
134
|
height: taroJdBaseInfo?.info?.sysInfo?.jdNativeHeaderHeight + 'px',
|
|
136
135
|
}}
|
|
137
136
|
className={shopContainerListStyle['d-luxury-header-black']}
|
|
138
137
|
/>
|
|
139
138
|
) : null}
|
|
140
139
|
{typeof item?.renderExtendComponent === 'function'
|
|
141
140
|
? item?.renderExtendComponent(item?.floorExtendData)
|
|
142
141
|
: null}
|
|
143
142
|
<View
|
|
144
143
|
className={classNames(
|
|
145
144
|
shopContainerListStyle['d-container-item'],
|
|
146
145
|
containerItemClass,
|
|
147
146
|
)}
|
|
148
147
|
id={getContainerId}
|
|
149
148
|
key={item.containerId}
|
|
150
149
|
data-container-id={item?.containerId}
|
|
151
150
|
data-container-type={item?.typeCode}
|
|
152
151
|
style={{
|
|
153
152
|
marginBottom: item.marginBottom ? `${item.marginBottom}px` : 0,
|
|
154
153
|
marginTop: item.marginTop ? `${item.marginTop}px` : 0,
|
|
155
154
|
marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
|
|
156
155
|
marginRight: item.marginRight ? `${item.marginRight}px` : 0,
|
|
157
156
|
borderTopLeftRadius: borderStyle?.borderTopLeftRadius || `0px`,
|
|
158
157
|
borderTopRightRadius: borderStyle?.borderTopRightRadiu || `0px`,
|
|
159
158
|
borderBottomLeftRadius: borderStyle?.borderBottomLeftRadius || `0px`,
|
|
160
159
|
borderBottomRightRadius: borderStyle?.borderBottomRightRadius || `0px`,
|
|
161
160
|
}}
|
|
162
161
|
>
|
|
163
162
|
{typeof item?.insertContainerStartComponent === 'function'
|
|
164
163
|
? item?.insertContainerStartComponent(item)
|
|
165
164
|
: null}
|
|
166
165
|
{item.floors &&
|
|
167
166
|
item.floors.length > 0 &&
|
|
168
167
|
item.floors?.map((floorItem, floorIndex) => {
|
|
169
168
|
return index > lazyLoadStartIndex ? (
|
|
170
169
|
<LazyLayoutLoad
|
|
171
170
|
key={item.containerId}
|
|
172
171
|
sectionType={sectionType}
|
|
173
172
|
containerId={getContainerId}
|
|
174
173
|
height={getFloorSetHeight(floorItem)}
|
|
175
174
|
floorData={floorItem}
|
|
176
175
|
>
|
|
177
176
|
{renderFloorItem(
|
|
178
177
|
item,
|
|
179
178
|
floorItem,
|
|
180
179
|
floorIndex,
|
|
181
180
|
containerLayoutLeftRightMargin,
|
|
182
181
|
true,
|
|
183
182
|
index,
|
|
184
183
|
borderStyle,
|
|
185
184
|
)}
|
|
186
185
|
</LazyLayoutLoad>
|
|
187
186
|
) : (
|
|
188
187
|
renderFloorItem(
|
|
189
188
|
item,
|
|
190
189
|
floorItem,
|
|
191
190
|
floorIndex,
|
|
192
191
|
containerLayoutLeftRightMargin,
|
|
193
192
|
false,
|
|
194
193
|
index,
|
|
195
194
|
borderStyle,
|
|
196
195
|
)
|
|
197
196
|
);
|
|
198
197
|
})}
|
|
199
198
|
</View>
|
|
200
199
|
</React.Fragment>
|
|
201
200
|
);
|
|
202
201
|
})
|
|
203
202
|
) : (
|
|
204
203
|
<View
|
|
205
204
|
className={classNames(shopContainerListStyle['d-container-list-no-data'], {
|
|
206
205
|
[shopContainerListStyle['d-sage-shop-no-data']]: hasLiveForSageShop,
|
|
207
206
|
})}
|
|
208
207
|
style={getNoDataContainerHeight()}
|
|
209
208
|
>
|
|
210
209
|
<NetworkDataError
|
|
211
210
|
netWorkShowType={NetWorkShowType.PART}
|
|
212
211
|
netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
|
|
213
212
|
backgroundColorWhite={hasLiveForSageShop}
|
|
214
213
|
refreshCallBackFn={refreshFloorListDataFn ? refreshFloorListDataFn : null}
|
|
215
214
|
btnLabel={refreshFloorListDataBtnLabel || ''}
|
|
216
215
|
/>
|
|
217
216
|
</View>
|
|
218
217
|
)}
|
|
219
218
|
</View>
|
|
220
219
|
</View>
|
|
221
220
|
);
|
|
222
221
|
updateShopDataFn: null,
|
|
222
|
+
import React from 'react';
|
|
223
223
|
NETWORK_DATA_TYPE,
|
|
224
224
|
M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
225
225
|
APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
226
226
|
containerFloorListData: ComponentInterFace.ContainerItemData[];
|
|
227
227
|
className?: string;
|
|
228
228
|
containerItemClass?: object;
|
|
229
229
|
style?: object;
|
|
230
230
|
hasGoodsFeeds?: boolean;
|
|
231
231
|
builtInComponents?: object;
|
|
232
232
|
loadingEndComponentFn?: functionType;
|
|
233
233
|
sectionType?: string;
|
|
234
234
|
updateShopFloorDataFn?: functionType;
|
|
235
235
|
updateContainerFloorListDataFn?: functionType;
|
|
236
236
|
refreshFloorListDataFn?: functionType;
|
|
237
237
|
refreshFloorListDataBtnLabel?: string;
|
|
238
238
|
customErrorIsvFloorModule?: React.ReactElement;
|
|
239
239
|
componentExtend?: React.ReactElement;
|
|
240
240
|
luxuryFixedIndex?: number;
|
|
241
241
|
isContainerListHasMarginBottom?: boolean;
|
|
242
242
|
switchConfig?: {
|
|
243
243
|
[key: string]: any;
|
|
244
244
|
};
|
|
245
245
|
const { windowHeight } = taroJdBaseInfo.info.sysInfo;
|
|
246
246
|
const {
|
|
247
247
|
className,
|
|
248
248
|
style,
|
|
249
249
|
containerItemClass = null,
|
|
250
250
|
containerFloorListData,
|
|
251
251
|
builtInComponents,
|
|
252
252
|
loadingEndComponentFn,
|
|
253
253
|
sectionType,
|
|
254
254
|
updateShopFloorDataFn,
|
|
255
255
|
updateContainerFloorListDataFn,
|
|
256
256
|
refreshFloorListDataFn,
|
|
257
257
|
refreshFloorListDataBtnLabel,
|
|
258
258
|
customErrorIsvFloorModule,
|
|
259
259
|
luxuryFixedIndex = -1,
|
|
260
260
|
isContainerListHasMarginBottom,
|
|
261
261
|
switchConfig,
|
|
262
262
|
} = props;
|
|
263
263
|
const emptyFloorListHidden = switchConfig?.emptyFloorListHidden || false;
|
|
264
264
|
const isSageShop = taroJdBaseInfo.info?.pageInfo?.isSageShop;
|
|
265
265
|
const isHasMarginBottom = isContainerListHasMarginBottom ?? !isSageShop;
|
|
266
266
|
|
|
267
267
|
const hasLiveForSageShop =
|
|
268
268
|
isSageShop && taroJdBaseInfo.info?.pageInfo?.isJdShowNativeImmersivePlayer;
|
|
269
269
|
|
|
270
270
|
const renderFloorItem = (
|
|
271
271
|
item,
|
|
272
272
|
floorItem,
|
|
273
273
|
floorIndex,
|
|
274
274
|
containerLayoutLeftRightMargin,
|
|
275
275
|
lazyLoadState = false,
|
|
276
276
|
index,
|
|
277
277
|
borderStyle,
|
|
278
278
|
) => {
|
|
279
279
|
return (
|
|
280
280
|
<View
|
|
281
281
|
className={classNames(shopContainerListStyle['d-floor-item'])}
|
|
282
282
|
data-floor-uid={floorItem?.uid}
|
|
283
283
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
284
284
|
data-lazy-load={lazyLoadState}
|
|
285
285
|
key={floorItem.uid}
|
|
286
286
|
id={`J_floor_${floorItem.uid}`}
|
|
287
287
|
style={borderStyle}
|
|
288
288
|
>
|
|
289
289
|
{isChartH5 && (
|
|
290
290
|
<View
|
|
291
291
|
className={shopContainerListStyle['d-floor-chart-item']}
|
|
292
292
|
id={`J_chart_floor_${floorItem?.uid}`}
|
|
293
293
|
data-floor-uid={floorItem?.uid}
|
|
294
294
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
295
295
|
/>
|
|
296
296
|
)}
|
|
297
297
|
<FloorListItem
|
|
298
298
|
floorIndex={floorIndex}
|
|
299
299
|
floorData={floorItem}
|
|
300
300
|
layoutLeftRightMargin={containerLayoutLeftRightMargin}
|
|
301
301
|
containerBorderRadius={borderStyle}
|
|
302
302
|
updateShopFloorDataFn={updateShopFloorDataFn}
|
|
303
303
|
loadingEndComponentFn={loadingEndComponentFn}
|
|
304
304
|
key={floorItem.uid}
|
|
305
305
|
builtInComponents={builtInComponents}
|
|
306
306
|
updateContainerFloorListDataFn={updateContainerFloorListDataFn}
|
|
307
307
|
customErrorIsvFloorModule={customErrorIsvFloorModule}
|
|
308
308
|
/>
|
|
309
309
|
{index === luxuryFixedIndex ? props.children : null}
|
|
310
310
|
</View>
|
|
311
311
|
);
|
|
312
312
|
};
|
|
313
313
|
|
|
314
314
|
const getFloorSetHeight = (item) => {
|
|
315
315
|
const getHeight = item?.floorExtInfo?.floorHeight
|
|
316
316
|
? Number(item?.floorExtInfo?.floorHeight)
|
|
317
317
|
: 200;
|
|
318
318
|
return getHeight > 0 ? getHeight : 200;
|
|
319
319
|
};
|
|
320
320
|
const containerFloorListDataLen = containerFloorListData.length;
|
|
321
321
|
|
|
322
322
|
const getNoDataContainerHeight = () => {
|
|
323
323
|
const changeHeight = hasLiveForSageShop
|
|
324
324
|
? windowHeight
|
|
325
325
|
: windowHeight -
|
|
326
326
|
(isJdApp
|
|
327
327
|
? APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT
|
|
328
328
|
: M_SHOP_DOWNLOAD_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT);
|
|
329
329
|
return {
|
|
330
330
|
height: `${changeHeight}px`,
|
|
331
331
|
};
|
|
332
332
|
};
|
|
333
333
|
return (
|
|
334
334
|
<View
|
|
335
335
|
className={classNames(className, shopContainerListStyle['d-shop-container-list'])}
|
|
336
336
|
style={style}
|
|
337
337
|
>
|
|
338
338
|
<View
|
|
339
339
|
id="J_shopContainerFloorList"
|
|
340
340
|
className={
|
|
341
341
|
isHasMarginBottom
|
|
342
342
|
? shopContainerListStyle['d-container-list-with-margin-bottom']
|
|
343
343
|
: shopContainerListStyle['d-container-list-no-margin-bottom']
|
|
344
344
|
}
|
|
345
345
|
>
|
|
346
346
|
{containerFloorListDataLen > 0 ? (
|
|
347
347
|
containerFloorListData.map((item, index) => {
|
|
348
348
|
const containerLayoutLeftRightMargin = (item.marginLeft || 0) + (item.marginRight || 0);
|
|
349
349
|
const getContainerId = `J_container_${item.containerId}`;
|
|
350
350
|
const borderStyle = getBorderStyle(
|
|
351
351
|
item,
|
|
352
352
|
index,
|
|
353
353
|
containerFloorListData,
|
|
354
354
|
containerFloorListDataLen,
|
|
355
355
|
);
|
|
356
356
|
return (
|
|
357
357
|
<React.Fragment key={item.containerId + index}>
|
|
358
358
|
{item.addLuxuryStyle ? (
|
|
359
359
|
<View className={shopContainerListStyle['d-luxury-header']} />
|
|
360
360
|
) : null}
|
|
361
361
|
{item.addLuxuryBackupStyle ? (
|
|
362
362
|
<View
|
|
363
363
|
style={{
|
|
364
364
|
height: taroJdBaseInfo?.info?.sysInfo?.jdNativeHeaderHeight + 'px',
|
|
365
365
|
}}
|
|
366
366
|
className={shopContainerListStyle['d-luxury-header-black']}
|
|
367
367
|
/>
|
|
368
368
|
) : null}
|
|
369
369
|
{typeof item?.renderExtendComponent === 'function'
|
|
370
370
|
? item?.renderExtendComponent(item?.floorExtendData)
|
|
371
371
|
: null}
|
|
372
372
|
<View
|
|
373
373
|
className={classNames(
|
|
374
374
|
shopContainerListStyle['d-container-item'],
|
|
375
375
|
containerItemClass,
|
|
376
376
|
)}
|
|
377
377
|
id={getContainerId}
|
|
378
378
|
key={item.containerId}
|
|
379
379
|
data-container-id={item?.containerId}
|
|
380
380
|
data-container-type={item?.typeCode}
|
|
381
381
|
style={{
|
|
382
382
|
marginBottom: item.marginBottom ? `${item.marginBottom}px` : 0,
|
|
383
383
|
marginTop: item.marginTop ? `${item.marginTop}px` : 0,
|
|
384
384
|
marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
|
|
385
385
|
marginRight: item.marginRight ? `${item.marginRight}px` : 0,
|
|
386
386
|
borderTopLeftRadius: borderStyle?.borderTopLeftRadius || `0px`,
|
|
387
387
|
borderTopRightRadius: borderStyle?.borderTopRightRadiu || `0px`,
|
|
388
388
|
borderBottomLeftRadius: borderStyle?.borderBottomLeftRadius || `0px`,
|
|
389
389
|
borderBottomRightRadius: borderStyle?.borderBottomRightRadius || `0px`,
|
|
390
390
|
}}
|
|
391
391
|
>
|
|
392
392
|
{typeof item?.insertContainerStartComponent === 'function'
|
|
393
393
|
? item?.insertContainerStartComponent(item)
|
|
394
394
|
: null}
|
|
395
395
|
{item.floors &&
|
|
396
396
|
item.floors.length > 0 &&
|
|
397
397
|
item.floors?.map((floorItem, floorIndex) => {
|
|
398
398
|
return index > lazyLoadStartIndex ? (
|
|
399
399
|
<LazyLayoutLoad
|
|
400
400
|
key={item.containerId}
|
|
401
401
|
sectionType={sectionType}
|
|
402
402
|
containerId={getContainerId}
|
|
403
403
|
height={getFloorSetHeight(floorItem)}
|
|
404
404
|
floorData={floorItem}
|
|
405
405
|
>
|
|
406
406
|
{renderFloorItem(
|
|
407
407
|
item,
|
|
408
408
|
floorItem,
|
|
409
409
|
floorIndex,
|
|
410
410
|
containerLayoutLeftRightMargin,
|
|
411
411
|
true,
|
|
412
412
|
index,
|
|
413
413
|
borderStyle,
|
|
414
414
|
)}
|
|
415
415
|
</LazyLayoutLoad>
|
|
416
416
|
) : (
|
|
417
417
|
renderFloorItem(
|
|
418
418
|
item,
|
|
419
419
|
floorItem,
|
|
420
420
|
floorIndex,
|
|
421
421
|
containerLayoutLeftRightMargin,
|
|
422
422
|
false,
|
|
423
423
|
index,
|
|
424
424
|
borderStyle,
|
|
425
425
|
)
|
|
426
426
|
);
|
|
427
427
|
})}
|
|
428
428
|
</View>
|
|
429
429
|
</React.Fragment>
|
|
430
430
|
);
|
|
431
431
|
})
|
|
432
432
|
) : !emptyFloorListHidden ? (
|
|
433
433
|
<View
|
|
434
434
|
className={classNames(shopContainerListStyle['d-container-list-no-data'], {
|
|
435
435
|
[shopContainerListStyle['d-sage-shop-no-data']]: hasLiveForSageShop,
|
|
436
436
|
})}
|
|
437
437
|
style={getNoDataContainerHeight()}
|
|
438
438
|
>
|
|
439
439
|
<NetworkDataError
|
|
440
440
|
netWorkShowType={NetWorkShowType.PART}
|
|
441
441
|
netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
|
|
442
442
|
backgroundColorWhite={hasLiveForSageShop}
|
|
443
443
|
refreshCallBackFn={refreshFloorListDataFn ? refreshFloorListDataFn : null}
|
|
444
444
|
btnLabel={refreshFloorListDataBtnLabel || ''}
|
|
445
445
|
/>
|
|
446
446
|
</View>
|
|
447
447
|
) : null}
|
|
448
448
|
</View>
|
|
449
449
|
</View>
|
|
450
450
|
);
|
|
451
451
|
updateShopDataFn: null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
NETWORK_DATA_TYPE,
|
|
3
2
|
TaroEventType,
|
|
4
3
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
5
4
|
SHOP_TAB_CONTENT_BOTTOM,
|
|
6
5
|
listData,
|
|
7
6
|
num = LOAD_FLOOR_BATCH_NUM,
|
|
8
7
|
let thisListData: ComponentInterFace.ContainerItemData[] | [] =
|
|
9
8
|
listData.slice(0)
|
|
10
9
|
const thisListDataLen = thisListData.length
|
|
11
10
|
const res: any[] = []
|
|
12
11
|
if (thisListDataLen) {
|
|
13
12
|
if (thisListDataLen < num) {
|
|
14
13
|
res.push(thisListData)
|
|
15
14
|
} else {
|
|
16
15
|
while (thisListData.length) {
|
|
17
16
|
if (thisListData.length >= num) {
|
|
18
17
|
res.push(thisListData.splice(0, num))
|
|
19
18
|
} else {
|
|
20
19
|
res.push(thisListData)
|
|
21
20
|
thisListData = []
|
|
22
21
|
}
|
|
23
22
|
}
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
return res
|
|
27
26
|
containerFloorListData: ComponentInterFace.ContainerItemData[]
|
|
28
27
|
className?: string
|
|
29
28
|
sectionType?: string
|
|
30
29
|
style?: object
|
|
31
30
|
hasGoodsFeeds?: boolean
|
|
32
31
|
miniScrollSelf?: boolean
|
|
33
32
|
tabContentShowState?: boolean
|
|
34
33
|
loadingEndComponentFn?: Function
|
|
35
34
|
updateShopFloorDataFn?: Function
|
|
36
35
|
builtInComponents?: Object
|
|
37
36
|
changeScrollToLowerStateFn: Function | null
|
|
38
37
|
changeLayoutScrollToTopFn?: Function
|
|
39
38
|
triggerMiniLoadProductWithFilterFn?: Function
|
|
40
39
|
const { windowHeight, actualNavBarHeight } = taroJdBaseInfo.info.sysInfo
|
|
41
40
|
const {
|
|
42
41
|
className,
|
|
43
42
|
style,
|
|
44
43
|
loadingEndComponentFn,
|
|
45
44
|
hasGoodsFeeds,
|
|
46
45
|
sectionType,
|
|
47
46
|
tabContentShowState,
|
|
48
47
|
containerFloorListData,
|
|
49
48
|
updateShopFloorDataFn,
|
|
50
49
|
changeScrollToLowerStateFn,
|
|
51
50
|
changeLayoutScrollToTopFn,
|
|
52
51
|
triggerMiniLoadProductWithFilterFn,
|
|
53
52
|
builtInComponents,
|
|
54
53
|
miniScrollSelf = false,
|
|
55
54
|
} = props
|
|
56
55
|
const [containerFloorListScrollTop, setContainerFloorListScrollTop] =
|
|
57
56
|
useState(0)
|
|
58
57
|
const loadMoreContainerFloorListDataRef = useRef({
|
|
59
58
|
needFirstLoadState: true,
|
|
60
59
|
loadingState: false,
|
|
61
60
|
})
|
|
62
61
|
const isFuncForChangeScrollToLowerStateFn =
|
|
63
62
|
typeof changeScrollToLowerStateFn == 'function'
|
|
64
63
|
const loadSectionTypeContainerFloorListRef = useRef<{
|
|
65
64
|
[key: string]: ComponentInterFace.MiniLoadFloorListRef
|
|
66
65
|
}>({
|
|
67
66
|
[`${sectionType}`]: {
|
|
68
67
|
index: 1,
|
|
69
68
|
itemNum: 0,
|
|
70
69
|
list: [],
|
|
71
70
|
loadList: [],
|
|
72
71
|
max: 1,
|
|
73
72
|
},
|
|
74
73
|
})
|
|
75
74
|
const [containerFloorList, setContainerFloorList] = useState<
|
|
76
75
|
ComponentInterFace.ContainerItemData[]
|
|
77
76
|
>(() => {
|
|
78
77
|
|
|
79
78
|
const getLoadDataArr = containerFloorListDataSpliceToPromise(
|
|
80
79
|
containerFloorListData,
|
|
81
80
|
)
|
|
82
81
|
const getThisSectionTypeListData =
|
|
83
82
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
84
83
|
getThisSectionTypeListData.list = getLoadDataArr
|
|
85
84
|
getThisSectionTypeListData.itemNum = containerFloorListData.length
|
|
86
85
|
getThisSectionTypeListData.max = getLoadDataArr.length
|
|
87
86
|
console.log('获取加载数据总数据----' + sectionType, getLoadDataArr)
|
|
88
87
|
const getThisLoadList = getLoadDataArr.shift()
|
|
89
88
|
if (getThisLoadList) {
|
|
90
89
|
getThisSectionTypeListData.loadList = getThisLoadList
|
|
91
90
|
return getThisLoadList
|
|
92
91
|
} else {
|
|
93
92
|
return []
|
|
94
93
|
}
|
|
95
94
|
})
|
|
96
95
|
useEffect(() => {
|
|
97
96
|
if (containerFloorList.length > 0) {
|
|
98
97
|
Taro.nextTick(() => {
|
|
99
98
|
const getThisSectionTypeListData =
|
|
100
99
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
101
100
|
console.log(
|
|
102
101
|
`加载${sectionType}中第${getThisSectionTypeListData.index}批次${LOAD_FLOOR_BATCH_NUM}个模块完毕,共计${getThisSectionTypeListData.max}轮,楼层总计${getThisSectionTypeListData.itemNum}`,
|
|
103
102
|
)
|
|
104
103
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState &&
|
|
105
104
|
checkLoadFloorListLoadState().then((needLoadState) => {
|
|
106
105
|
console.log('检查是否需要继续加载状态', needLoadState)
|
|
107
106
|
if (needLoadState) {
|
|
108
107
|
const getThisLoadList = getThisSectionTypeListData.list.shift()
|
|
109
108
|
if (getThisLoadList) {
|
|
110
109
|
getThisSectionTypeListData.index++
|
|
111
110
|
const changeContainerList: ComponentInterFace.ContainerItemData[] =
|
|
112
111
|
[...getThisSectionTypeListData.loadList, ...getThisLoadList]
|
|
113
112
|
getThisSectionTypeListData.loadList = changeContainerList
|
|
114
113
|
setContainerFloorList(changeContainerList)
|
|
115
114
|
} else {
|
|
116
115
|
Taro.hideLoading()
|
|
117
116
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState =
|
|
118
117
|
false
|
|
119
118
|
}
|
|
120
119
|
} else {
|
|
121
120
|
Taro.hideLoading()
|
|
122
121
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState =
|
|
123
122
|
false
|
|
124
123
|
}
|
|
125
124
|
})
|
|
126
125
|
})
|
|
127
126
|
}
|
|
128
127
|
}, [containerFloorList])
|
|
129
128
|
|
|
130
129
|
const checkLoadFloorListLoadState = () => {
|
|
131
130
|
return new Promise((resolve) => {
|
|
132
131
|
Taro.createSelectorQuery()
|
|
133
132
|
.select('#J_shopContainerFloorList')
|
|
134
133
|
.boundingClientRect(function (rect) {
|
|
135
134
|
if (rect) {
|
|
136
135
|
if (rect.height && rect.height < windowHeight + 100) {
|
|
137
136
|
resolve(true)
|
|
138
137
|
} else {
|
|
139
138
|
resolve(false)
|
|
140
139
|
}
|
|
141
140
|
} else {
|
|
142
141
|
resolve(true)
|
|
143
142
|
}
|
|
144
143
|
})
|
|
145
144
|
.exec()
|
|
146
145
|
})
|
|
147
146
|
}
|
|
148
147
|
|
|
149
148
|
const loadMoreContainerFloorList = (evt: any = false) => {
|
|
150
149
|
const getThisSectionTypeListData =
|
|
151
150
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
152
151
|
if (
|
|
153
152
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
154
153
|
getThisSectionTypeListData.list.length > 0
|
|
155
154
|
) {
|
|
156
155
|
loadMoreContainerFloorListDataRef.current.loadingState = true
|
|
157
156
|
getThisSectionTypeListData.index++
|
|
158
157
|
console.log(
|
|
159
158
|
`当前即将加载${sectionType}中第${getThisSectionTypeListData.index}轮`,
|
|
160
159
|
)
|
|
161
160
|
const getThisLoadList = getThisSectionTypeListData.list.shift()
|
|
162
161
|
if (getThisLoadList) {
|
|
163
162
|
const changeFloorList = [
|
|
164
163
|
...getThisSectionTypeListData.loadList,
|
|
165
164
|
...getThisLoadList,
|
|
166
165
|
]
|
|
167
166
|
getThisSectionTypeListData.loadList = changeFloorList
|
|
168
167
|
loadMoreContainerFloorListDataRef.current.loadingState = false
|
|
169
168
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false)
|
|
170
169
|
setContainerFloorList(changeFloorList)
|
|
171
170
|
Taro.nextTick(() => {
|
|
172
171
|
if (getThisSectionTypeListData.list.length == 0) {
|
|
173
172
|
typeof triggerMiniLoadProductWithFilterFn == 'function' &&
|
|
174
173
|
triggerMiniLoadProductWithFilterFn()
|
|
175
174
|
}
|
|
176
175
|
})
|
|
177
176
|
} else {
|
|
178
177
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false)
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
if (
|
|
182
181
|
miniScrollSelf &&
|
|
183
182
|
evt &&
|
|
184
183
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
185
184
|
getThisSectionTypeListData.index >= getThisSectionTypeListData.max
|
|
186
185
|
) {
|
|
187
186
|
pageScrollToLower(evt)
|
|
188
187
|
}
|
|
189
188
|
}
|
|
190
189
|
useEffect(() => {
|
|
191
190
|
if (!miniScrollSelf) {
|
|
192
191
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL_END, (tabActiveType) => {
|
|
193
192
|
if (tabActiveType == sectionType && tabContentShowState) {
|
|
194
193
|
loadMoreContainerFloorList()
|
|
195
194
|
}
|
|
196
195
|
})
|
|
197
196
|
}
|
|
198
197
|
}, [])
|
|
199
198
|
const pageScrollToLower = useCallback((evt) => {
|
|
200
199
|
console.log('触发滚动底部位置', evt.detail)
|
|
201
200
|
Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL_END)
|
|
202
201
|
}, [])
|
|
203
202
|
|
|
204
203
|
const onScrollRecord = (event) => {
|
|
205
204
|
const { detail } = event
|
|
206
205
|
if (detail) {
|
|
207
206
|
taroJdBaseInfo.info.pageInfo.miniScrollInfo = detail
|
|
208
207
|
}
|
|
209
208
|
}
|
|
210
209
|
const renderFloorItem = useCallback(
|
|
211
210
|
(
|
|
212
211
|
item,
|
|
213
212
|
floorItem,
|
|
214
213
|
floorIndex,
|
|
215
214
|
containerLayoutLeftRightMargin,
|
|
216
215
|
borderStyle,
|
|
217
216
|
) => {
|
|
218
217
|
return (
|
|
219
218
|
<View
|
|
220
219
|
className={classNames(shopContainerListStyle['d-floor-item'])}
|
|
221
220
|
id={`J_floor_${floorItem?.uid}`}
|
|
222
221
|
key={floorItem.uid}
|
|
223
222
|
data-floor-uid={floorItem?.uid}
|
|
224
223
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
225
224
|
style={borderStyle}
|
|
226
225
|
>
|
|
227
226
|
<FloorListItem
|
|
228
227
|
floorIndex={floorIndex}
|
|
229
228
|
floorData={floorItem}
|
|
230
229
|
layoutLeftRightMargin={containerLayoutLeftRightMargin}
|
|
231
230
|
containerBorderRadius={borderStyle}
|
|
232
231
|
updateShopFloorDataFn={updateShopFloorDataFn}
|
|
233
232
|
loadingEndComponentFn={loadingEndComponentFn}
|
|
234
233
|
changeScrollToLowerStateFn={changeScrollToLowerStateFn}
|
|
235
234
|
key={floorItem.uid}
|
|
236
235
|
changeScrollTopFn={changeContainerFloorListScrollTop}
|
|
237
236
|
builtInComponents={builtInComponents}
|
|
238
237
|
/>
|
|
239
238
|
</View>
|
|
240
239
|
)
|
|
241
240
|
},
|
|
242
241
|
[],
|
|
243
242
|
)
|
|
244
243
|
const changeContainerFloorListScrollTop = (top) => {
|
|
245
244
|
if (miniScrollSelf) {
|
|
246
245
|
setContainerFloorListScrollTop(top)
|
|
247
246
|
} else {
|
|
248
247
|
typeof changeLayoutScrollToTopFn == 'function' &&
|
|
249
248
|
changeLayoutScrollToTopFn(top)
|
|
250
249
|
}
|
|
251
250
|
}
|
|
252
251
|
const renderContainerList = () => {
|
|
253
252
|
const listNum = containerFloorList.length || 0
|
|
254
253
|
const getThisSectionTypeListData =
|
|
255
254
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
|
|
256
255
|
return (
|
|
257
256
|
<View id="J_shopContainerFloorList">
|
|
258
257
|
{containerFloorListData && containerFloorListData.length > 0 ? (
|
|
259
258
|
listNum > 0 && (
|
|
260
259
|
<>
|
|
261
260
|
{containerFloorList.map((item, index) => {
|
|
262
261
|
const containerLayoutLeftRightMargin =
|
|
263
262
|
(item.marginLeft || 0) + (item.marginRight || 0)
|
|
264
263
|
const getContainerId = `J_container_${item.containerId}`
|
|
265
264
|
const borderStyle = getBorderStyle(
|
|
266
265
|
item,
|
|
267
266
|
index,
|
|
268
267
|
containerFloorList,
|
|
269
268
|
listNum,
|
|
270
269
|
)
|
|
271
270
|
if (index === listNum - 1) item.marginBottom = 8
|
|
272
271
|
return (
|
|
273
272
|
<View
|
|
274
273
|
className={shopContainerListStyle['d-container-item']}
|
|
275
274
|
id={getContainerId}
|
|
276
275
|
key={item.containerId + item.key}
|
|
277
276
|
style={{
|
|
278
277
|
marginBottom: item.marginBottom
|
|
279
278
|
? `${item.marginBottom}px`
|
|
280
279
|
: 0,
|
|
281
280
|
marginTop: item.marginTop ? `${item.marginTop}px` : 0,
|
|
282
281
|
marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
|
|
283
282
|
marginRight: item.marginRight
|
|
284
283
|
? `${item.marginRight}px`
|
|
285
284
|
: 0,
|
|
286
285
|
borderTopLeftRadius:
|
|
287
286
|
borderStyle?.borderTopLeftRadius || `0px`,
|
|
288
287
|
borderTopRightRadius:
|
|
289
288
|
borderStyle?.borderTopRightRadiu || `0px`,
|
|
290
289
|
borderBottomLeftRadius:
|
|
291
290
|
borderStyle?.borderBottomLeftRadius || `0px`,
|
|
292
291
|
borderBottomRightRadius:
|
|
293
292
|
borderStyle?.borderBottomRightRadius || `0px`,
|
|
294
293
|
}}
|
|
295
294
|
>
|
|
296
295
|
{item.floors.length > 0 && (
|
|
297
296
|
<>
|
|
298
297
|
{item.floors?.map((floorItem, floorIndex) => {
|
|
299
298
|
return renderFloorItem(
|
|
300
299
|
item,
|
|
301
300
|
floorItem,
|
|
302
301
|
floorIndex,
|
|
303
302
|
containerLayoutLeftRightMargin,
|
|
304
303
|
borderStyle,
|
|
305
304
|
)
|
|
306
305
|
})}
|
|
307
306
|
</>
|
|
308
307
|
)}
|
|
309
308
|
</View>
|
|
310
309
|
)
|
|
311
310
|
})}
|
|
312
311
|
{getThisSectionTypeListData.index <
|
|
313
312
|
getThisSectionTypeListData.max && (
|
|
314
313
|
<JdLoading localState={true} text="加载中..." />
|
|
315
314
|
)}
|
|
316
315
|
{!hasGoodsFeeds &&
|
|
317
316
|
getThisSectionTypeListData.index >=
|
|
318
317
|
getThisSectionTypeListData.max &&
|
|
319
318
|
loadingEndComponentFn &&
|
|
320
319
|
loadingEndComponentFn()}
|
|
321
320
|
</>
|
|
322
321
|
)
|
|
323
322
|
) : (
|
|
324
323
|
<View
|
|
325
324
|
className={shopContainerListStyle['d-container-list-no-data']}
|
|
326
325
|
style={{
|
|
327
326
|
height: `${
|
|
328
327
|
windowHeight -
|
|
329
328
|
actualNavBarHeight -
|
|
330
329
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT +
|
|
331
330
|
SHOP_TAB_CONTENT_BOTTOM
|
|
332
331
|
}px`,
|
|
333
332
|
}}
|
|
334
333
|
>
|
|
335
334
|
<NetworkDataError
|
|
336
335
|
netWorkShowType={NetWorkShowType.PART}
|
|
337
336
|
netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
|
|
338
337
|
refreshCallBackFn={updateShopFloorDataFn}
|
|
339
338
|
/>
|
|
340
339
|
</View>
|
|
341
340
|
)}
|
|
342
341
|
</View>
|
|
343
342
|
)
|
|
344
343
|
}
|
|
345
344
|
return miniScrollSelf ? (
|
|
346
345
|
<ScrollView
|
|
347
346
|
scrollY
|
|
348
347
|
scrollTop={containerFloorListScrollTop}
|
|
349
348
|
className={classNames(
|
|
350
349
|
className,
|
|
351
350
|
shopContainerListStyle['d-shop-container-list'],
|
|
352
351
|
)}
|
|
353
352
|
onScroll={onScrollRecord}
|
|
354
353
|
lowerThreshold={windowHeight / 2}
|
|
355
354
|
onScrollToLower={loadMoreContainerFloorList}
|
|
356
355
|
style={style}
|
|
357
356
|
>
|
|
358
357
|
{tabContentShowState && renderContainerList()}
|
|
359
358
|
</ScrollView>
|
|
360
359
|
) : (
|
|
361
360
|
<View
|
|
362
361
|
className={classNames(
|
|
363
362
|
className,
|
|
364
363
|
shopContainerListStyle['d-shop-container-list'],
|
|
365
364
|
)}
|
|
366
365
|
style={style}
|
|
367
366
|
>
|
|
368
367
|
{tabContentShowState && renderContainerList()}
|
|
369
368
|
</View>
|
|
370
369
|
)
|
|
370
|
+
import Taro from '@tarojs/taro';
|
|
371
371
|
NETWORK_DATA_TYPE,
|
|
372
372
|
TaroEventType,
|
|
373
373
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT,
|
|
374
374
|
SHOP_TAB_CONTENT_BOTTOM,
|
|
375
375
|
let thisListData: ComponentInterFace.ContainerItemData[] | [] = listData.slice(0);
|
|
376
376
|
const thisListDataLen = thisListData.length;
|
|
377
377
|
const res: any[] = [];
|
|
378
378
|
if (thisListDataLen) {
|
|
379
379
|
if (thisListDataLen < num) {
|
|
380
380
|
res.push(thisListData);
|
|
381
381
|
} else {
|
|
382
382
|
while (thisListData.length) {
|
|
383
383
|
if (thisListData.length >= num) {
|
|
384
384
|
res.push(thisListData.splice(0, num));
|
|
385
385
|
} else {
|
|
386
386
|
res.push(thisListData);
|
|
387
387
|
thisListData = [];
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
return res;
|
|
393
393
|
containerFloorListData: ComponentInterFace.ContainerItemData[];
|
|
394
394
|
className?: string;
|
|
395
395
|
sectionType?: string;
|
|
396
396
|
style?: object;
|
|
397
397
|
hasGoodsFeeds?: boolean;
|
|
398
398
|
miniScrollSelf?: boolean;
|
|
399
399
|
tabContentShowState?: boolean;
|
|
400
400
|
loadingEndComponentFn?: functionType;
|
|
401
401
|
updateShopFloorDataFn?: functionType;
|
|
402
402
|
builtInComponents?: object;
|
|
403
403
|
changeScrollToLowerStateFn: functionType | null;
|
|
404
404
|
changeLayoutScrollToTopFn?: functionType;
|
|
405
405
|
triggerMiniLoadProductWithFilterFn?: functionType;
|
|
406
406
|
switchConfig?: {
|
|
407
407
|
[key: string]: any;
|
|
408
408
|
};
|
|
409
409
|
const { windowHeight, actualNavBarHeight } = taroJdBaseInfo.info.sysInfo;
|
|
410
410
|
const {
|
|
411
411
|
className,
|
|
412
412
|
style,
|
|
413
413
|
loadingEndComponentFn,
|
|
414
414
|
hasGoodsFeeds,
|
|
415
415
|
sectionType,
|
|
416
416
|
tabContentShowState,
|
|
417
417
|
containerFloorListData,
|
|
418
418
|
updateShopFloorDataFn,
|
|
419
419
|
changeScrollToLowerStateFn,
|
|
420
420
|
changeLayoutScrollToTopFn,
|
|
421
421
|
triggerMiniLoadProductWithFilterFn,
|
|
422
422
|
builtInComponents,
|
|
423
423
|
miniScrollSelf = false,
|
|
424
424
|
switchConfig,
|
|
425
425
|
} = props;
|
|
426
426
|
const emptyFloorListHidden = switchConfig?.emptyFloorListHidden || false;
|
|
427
427
|
const [containerFloorListScrollTop, setContainerFloorListScrollTop] = useState(0);
|
|
428
428
|
const loadMoreContainerFloorListDataRef = useRef({
|
|
429
429
|
needFirstLoadState: true,
|
|
430
430
|
loadingState: false,
|
|
431
431
|
});
|
|
432
432
|
const isFuncForChangeScrollToLowerStateFn = typeof changeScrollToLowerStateFn === 'function';
|
|
433
433
|
const loadSectionTypeContainerFloorListRef = useRef<{
|
|
434
434
|
[key: string]: ComponentInterFace.MiniLoadFloorListRef;
|
|
435
435
|
}>({
|
|
436
436
|
[`${sectionType}`]: {
|
|
437
437
|
index: 1,
|
|
438
438
|
itemNum: 0,
|
|
439
439
|
list: [],
|
|
440
440
|
loadList: [],
|
|
441
441
|
max: 1,
|
|
442
442
|
},
|
|
443
443
|
});
|
|
444
444
|
const [containerFloorList, setContainerFloorList] = useState<
|
|
445
445
|
ComponentInterFace.ContainerItemData[]
|
|
446
446
|
>(() => {
|
|
447
447
|
|
|
448
448
|
const getLoadDataArr = containerFloorListDataSpliceToPromise(containerFloorListData);
|
|
449
449
|
const getThisSectionTypeListData =
|
|
450
450
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
451
451
|
getThisSectionTypeListData.list = getLoadDataArr;
|
|
452
452
|
getThisSectionTypeListData.itemNum = containerFloorListData.length;
|
|
453
453
|
getThisSectionTypeListData.max = getLoadDataArr.length;
|
|
454
454
|
console.log('获取加载数据总数据----' + sectionType, getLoadDataArr);
|
|
455
455
|
const getThisLoadList = getLoadDataArr.shift();
|
|
456
456
|
if (getThisLoadList) {
|
|
457
457
|
getThisSectionTypeListData.loadList = getThisLoadList;
|
|
458
458
|
return getThisLoadList;
|
|
459
459
|
} else {
|
|
460
460
|
return [];
|
|
461
461
|
}
|
|
462
462
|
});
|
|
463
463
|
useEffect(() => {
|
|
464
464
|
if (containerFloorList.length > 0) {
|
|
465
465
|
Taro.nextTick(() => {
|
|
466
466
|
const getThisSectionTypeListData =
|
|
467
467
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
468
468
|
console.log(
|
|
469
469
|
`加载${sectionType}中第${getThisSectionTypeListData.index}批次${LOAD_FLOOR_BATCH_NUM}个模块完毕,共计${getThisSectionTypeListData.max}轮,楼层总计${getThisSectionTypeListData.itemNum}`,
|
|
470
470
|
);
|
|
471
471
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState &&
|
|
472
472
|
checkLoadFloorListLoadState().then((needLoadState) => {
|
|
473
473
|
console.log('检查是否需要继续加载状态', needLoadState);
|
|
474
474
|
if (needLoadState) {
|
|
475
475
|
const getThisLoadList = getThisSectionTypeListData.list.shift();
|
|
476
476
|
if (getThisLoadList) {
|
|
477
477
|
getThisSectionTypeListData.index++;
|
|
478
478
|
const changeContainerList: ComponentInterFace.ContainerItemData[] = [
|
|
479
479
|
...getThisSectionTypeListData.loadList,
|
|
480
480
|
...getThisLoadList,
|
|
481
481
|
];
|
|
482
482
|
getThisSectionTypeListData.loadList = changeContainerList;
|
|
483
483
|
setContainerFloorList(changeContainerList);
|
|
484
484
|
} else {
|
|
485
485
|
Taro.hideLoading();
|
|
486
486
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState = false;
|
|
487
487
|
}
|
|
488
488
|
} else {
|
|
489
489
|
Taro.hideLoading();
|
|
490
490
|
loadMoreContainerFloorListDataRef.current.needFirstLoadState = false;
|
|
491
491
|
}
|
|
492
492
|
});
|
|
493
493
|
});
|
|
494
494
|
}
|
|
495
495
|
}, [containerFloorList]);
|
|
496
496
|
|
|
497
497
|
const checkLoadFloorListLoadState = () => {
|
|
498
498
|
return new Promise((resolve) => {
|
|
499
499
|
Taro.createSelectorQuery()
|
|
500
500
|
.select('#J_shopContainerFloorList')
|
|
501
501
|
.boundingClientRect(function (rect) {
|
|
502
502
|
if (rect) {
|
|
503
503
|
if (rect.height && rect.height < windowHeight + 100) {
|
|
504
504
|
resolve(true);
|
|
505
505
|
} else {
|
|
506
506
|
resolve(false);
|
|
507
507
|
}
|
|
508
508
|
} else {
|
|
509
509
|
resolve(true);
|
|
510
510
|
}
|
|
511
511
|
})
|
|
512
512
|
.exec();
|
|
513
513
|
});
|
|
514
514
|
};
|
|
515
515
|
|
|
516
516
|
const loadMoreContainerFloorList = (evt: any = false) => {
|
|
517
517
|
const getThisSectionTypeListData =
|
|
518
518
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
519
519
|
if (
|
|
520
520
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
521
521
|
getThisSectionTypeListData.list.length > 0
|
|
522
522
|
) {
|
|
523
523
|
loadMoreContainerFloorListDataRef.current.loadingState = true;
|
|
524
524
|
getThisSectionTypeListData.index++;
|
|
525
525
|
console.log(`当前即将加载${sectionType}中第${getThisSectionTypeListData.index}轮`);
|
|
526
526
|
const getThisLoadList = getThisSectionTypeListData.list.shift();
|
|
527
527
|
if (getThisLoadList) {
|
|
528
528
|
const changeFloorList = [...getThisSectionTypeListData.loadList, ...getThisLoadList];
|
|
529
529
|
getThisSectionTypeListData.loadList = changeFloorList;
|
|
530
530
|
loadMoreContainerFloorListDataRef.current.loadingState = false;
|
|
531
531
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false);
|
|
532
532
|
setContainerFloorList(changeFloorList);
|
|
533
533
|
Taro.nextTick(() => {
|
|
534
534
|
if (getThisSectionTypeListData.list.length == 0) {
|
|
535
535
|
typeof triggerMiniLoadProductWithFilterFn === 'function' &&
|
|
536
536
|
triggerMiniLoadProductWithFilterFn();
|
|
537
537
|
}
|
|
538
538
|
});
|
|
539
539
|
} else {
|
|
540
540
|
isFuncForChangeScrollToLowerStateFn && changeScrollToLowerStateFn(false);
|
|
541
541
|
}
|
|
542
542
|
}
|
|
543
543
|
if (
|
|
544
544
|
miniScrollSelf &&
|
|
545
545
|
evt &&
|
|
546
546
|
!loadMoreContainerFloorListDataRef.current.loadingState &&
|
|
547
547
|
getThisSectionTypeListData.index >= getThisSectionTypeListData.max
|
|
548
548
|
) {
|
|
549
549
|
pageScrollToLower(evt);
|
|
550
550
|
}
|
|
551
551
|
};
|
|
552
552
|
useEffect(() => {
|
|
553
553
|
if (!miniScrollSelf) {
|
|
554
554
|
Taro.eventCenter.on(TaroEventType.PAGE_SCROLL_END, (tabActiveType) => {
|
|
555
555
|
if (tabActiveType == sectionType && tabContentShowState) {
|
|
556
556
|
loadMoreContainerFloorList();
|
|
557
557
|
}
|
|
558
558
|
});
|
|
559
559
|
}
|
|
560
560
|
}, []);
|
|
561
561
|
const pageScrollToLower = useCallback((evt) => {
|
|
562
562
|
console.log('触发滚动底部位置', evt.detail);
|
|
563
563
|
Taro.eventCenter.trigger(TaroEventType.PAGE_SCROLL_END);
|
|
564
564
|
}, []);
|
|
565
565
|
|
|
566
566
|
const onScrollRecord = (event) => {
|
|
567
567
|
const { detail } = event;
|
|
568
568
|
if (detail) {
|
|
569
569
|
taroJdBaseInfo.info.pageInfo.miniScrollInfo = detail;
|
|
570
570
|
}
|
|
571
571
|
};
|
|
572
572
|
const renderFloorItem = useCallback(
|
|
573
573
|
(item, floorItem, floorIndex, containerLayoutLeftRightMargin, borderStyle) => {
|
|
574
574
|
return (
|
|
575
575
|
<View
|
|
576
576
|
className={classNames(shopContainerListStyle['d-floor-item'])}
|
|
577
577
|
id={`J_floor_${floorItem?.uid}`}
|
|
578
578
|
key={floorItem.uid}
|
|
579
579
|
data-floor-uid={floorItem?.uid}
|
|
580
580
|
data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
|
|
581
581
|
style={borderStyle}
|
|
582
582
|
>
|
|
583
583
|
<FloorListItem
|
|
584
584
|
floorIndex={floorIndex}
|
|
585
585
|
floorData={floorItem}
|
|
586
586
|
layoutLeftRightMargin={containerLayoutLeftRightMargin}
|
|
587
587
|
containerBorderRadius={borderStyle}
|
|
588
588
|
updateShopFloorDataFn={updateShopFloorDataFn}
|
|
589
589
|
loadingEndComponentFn={loadingEndComponentFn}
|
|
590
590
|
changeScrollToLowerStateFn={changeScrollToLowerStateFn}
|
|
591
591
|
key={floorItem.uid}
|
|
592
592
|
changeScrollTopFn={changeContainerFloorListScrollTop}
|
|
593
593
|
builtInComponents={builtInComponents}
|
|
594
594
|
/>
|
|
595
595
|
</View>
|
|
596
596
|
);
|
|
597
597
|
},
|
|
598
598
|
[],
|
|
599
599
|
);
|
|
600
600
|
const changeContainerFloorListScrollTop = (top) => {
|
|
601
601
|
if (miniScrollSelf) {
|
|
602
602
|
setContainerFloorListScrollTop(top);
|
|
603
603
|
} else {
|
|
604
604
|
typeof changeLayoutScrollToTopFn === 'function' && changeLayoutScrollToTopFn(top);
|
|
605
605
|
}
|
|
606
606
|
};
|
|
607
607
|
const renderContainerList = () => {
|
|
608
608
|
const listNum = containerFloorList.length || 0;
|
|
609
609
|
const getThisSectionTypeListData =
|
|
610
610
|
loadSectionTypeContainerFloorListRef.current[`${sectionType}`];
|
|
611
611
|
return (
|
|
612
612
|
<View id="J_shopContainerFloorList">
|
|
613
613
|
{containerFloorListData && containerFloorListData.length > 0 ? (
|
|
614
614
|
listNum > 0 && (
|
|
615
615
|
<>
|
|
616
616
|
{containerFloorList.map((item, index) => {
|
|
617
617
|
const containerLayoutLeftRightMargin =
|
|
618
618
|
(item.marginLeft || 0) + (item.marginRight || 0);
|
|
619
619
|
const getContainerId = `J_container_${item.containerId}`;
|
|
620
620
|
const borderStyle = getBorderStyle(item, index, containerFloorList, listNum);
|
|
621
621
|
if (index === listNum - 1) item.marginBottom = 8;
|
|
622
622
|
return (
|
|
623
623
|
<View
|
|
624
624
|
className={shopContainerListStyle['d-container-item']}
|
|
625
625
|
id={getContainerId}
|
|
626
626
|
key={item.containerId + item.key}
|
|
627
627
|
style={{
|
|
628
628
|
marginBottom: item.marginBottom ? `${item.marginBottom}px` : 0,
|
|
629
629
|
marginTop: item.marginTop ? `${item.marginTop}px` : 0,
|
|
630
630
|
marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
|
|
631
631
|
marginRight: item.marginRight ? `${item.marginRight}px` : 0,
|
|
632
632
|
borderTopLeftRadius: borderStyle?.borderTopLeftRadius || `0px`,
|
|
633
633
|
borderTopRightRadius: borderStyle?.borderTopRightRadiu || `0px`,
|
|
634
634
|
borderBottomLeftRadius: borderStyle?.borderBottomLeftRadius || `0px`,
|
|
635
635
|
borderBottomRightRadius: borderStyle?.borderBottomRightRadius || `0px`,
|
|
636
636
|
}}
|
|
637
637
|
>
|
|
638
638
|
{item.floors.length > 0 && (
|
|
639
639
|
<>
|
|
640
640
|
{item.floors?.map((floorItem, floorIndex) => {
|
|
641
641
|
return renderFloorItem(
|
|
642
642
|
item,
|
|
643
643
|
floorItem,
|
|
644
644
|
floorIndex,
|
|
645
645
|
containerLayoutLeftRightMargin,
|
|
646
646
|
borderStyle,
|
|
647
647
|
);
|
|
648
648
|
})}
|
|
649
649
|
</>
|
|
650
650
|
)}
|
|
651
651
|
</View>
|
|
652
652
|
);
|
|
653
653
|
})}
|
|
654
654
|
{getThisSectionTypeListData.index < getThisSectionTypeListData.max && (
|
|
655
655
|
<JdLoading localState={true} text="加载中..." />
|
|
656
656
|
)}
|
|
657
657
|
{!hasGoodsFeeds &&
|
|
658
658
|
getThisSectionTypeListData.index >= getThisSectionTypeListData.max &&
|
|
659
659
|
loadingEndComponentFn &&
|
|
660
660
|
loadingEndComponentFn()}
|
|
661
661
|
</>
|
|
662
662
|
)
|
|
663
663
|
) : !emptyFloorListHidden ? (
|
|
664
664
|
<View
|
|
665
665
|
className={shopContainerListStyle['d-container-list-no-data']}
|
|
666
666
|
style={{
|
|
667
667
|
height: `${
|
|
668
668
|
windowHeight -
|
|
669
669
|
actualNavBarHeight -
|
|
670
670
|
MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT +
|
|
671
671
|
SHOP_TAB_CONTENT_BOTTOM
|
|
672
672
|
}px`,
|
|
673
673
|
}}
|
|
674
674
|
>
|
|
675
675
|
<NetworkDataError
|
|
676
676
|
netWorkShowType={NetWorkShowType.PART}
|
|
677
677
|
netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
|
|
678
678
|
refreshCallBackFn={updateShopFloorDataFn}
|
|
679
679
|
/>
|
|
680
680
|
</View>
|
|
681
681
|
) : null}
|
|
682
682
|
</View>
|
|
683
683
|
);
|
|
684
684
|
};
|
|
685
685
|
return miniScrollSelf ? (
|
|
686
686
|
<ScrollView
|
|
687
687
|
scrollY
|
|
688
688
|
scrollTop={containerFloorListScrollTop}
|
|
689
689
|
className={classNames(className, shopContainerListStyle['d-shop-container-list'])}
|
|
690
690
|
onScroll={onScrollRecord}
|
|
691
691
|
lowerThreshold={windowHeight / 2}
|
|
692
692
|
onScrollToLower={loadMoreContainerFloorList}
|
|
693
693
|
style={style}
|
|
694
694
|
>
|
|
695
695
|
{tabContentShowState && renderContainerList()}
|
|
696
696
|
</ScrollView>
|
|
697
697
|
) : (
|
|
698
698
|
<View
|
|
699
699
|
className={classNames(className, shopContainerListStyle['d-shop-container-list'])}
|
|
700
700
|
style={style}
|
|
701
701
|
>
|
|
702
702
|
{tabContentShowState && renderContainerList()}
|
|
703
703
|
</View>
|
|
704
704
|
);
|