@conecli/cone-render 0.10.1-shop-beta.24 → 0.10.1-shop-beta.26

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