@conecli/cone-render 0.9.1-shop2.3 → 0.9.1-shop2.4

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