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

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 (113) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/assets/icon_blue_info.svg +1 -0
  3. package/dist/common/const.ts +1 -1
  4. package/dist/common/environmentType.ts +1 -0
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.ts +1 -0
  10. package/dist/common/jssdk.ts +1 -0
  11. package/dist/common/pageType.ts +1 -0
  12. package/dist/common/sgmCustomCode.ts +1 -0
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/token/token.ts +1 -1
  16. package/dist/common/wxappApi.jd.ts +1 -0
  17. package/dist/components/ErrorBoundary.tsx +1 -1
  18. package/dist/components/base/CountDown/index.tsx +1 -1
  19. package/dist/components/base/CustomScrollView/index.jd.tsx +1 -0
  20. package/dist/components/base/CustomScrollView/index.module.scss +7 -0
  21. package/dist/components/base/CustomScrollView/index.tsx +1 -1
  22. package/dist/components/base/CustomVideo/common.ts +1 -0
  23. package/dist/components/base/CustomVideo/index.tsx +1 -1
  24. package/dist/components/base/Dialog/index.module.scss +5 -0
  25. package/dist/components/base/Dialog/index.tsx +1 -1
  26. package/dist/components/base/Exposure/index.h5.tsx +1 -1
  27. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  28. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  29. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  30. package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
  31. package/dist/components/base/InViewRender/index.tsx +1 -1
  32. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  33. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  34. package/dist/components/base/LazyLoadImage/const.ts +1 -1
  35. package/dist/components/base/LazyLoadImage/index.h5.module.scss +23 -20
  36. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  37. package/dist/components/base/MobileCommonHeader/index.module.scss +17 -0
  38. package/dist/components/base/MobileCommonHeader/index.tsx +1 -0
  39. package/dist/components/base/NetworkDataError/const.ts +1 -1
  40. package/dist/components/base/NetworkDataError/index.module.scss +7 -0
  41. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  42. package/dist/components/base/Price/Base/index.tsx +1 -1
  43. package/dist/components/base/Price/Double/index.tsx +1 -1
  44. package/dist/components/base/Price/index.tsx +1 -1
  45. package/dist/components/debug/DebugLayout/index.module.scss +67 -0
  46. package/dist/components/debug/DebugLayout/index.tsx +1 -0
  47. package/dist/components/debug/DebugLayout/utils.ts +1 -0
  48. package/dist/components/decorate/DecorateFloorModule/index.module.scss +32 -2
  49. package/dist/components/decorate/DecorateFloorModule/index.tsx +1 -1
  50. package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
  51. package/dist/components/decorate/PlaceHolder/index.tsx +1 -1
  52. package/dist/components/floorItem.jd.tsx +1 -1
  53. package/dist/components/floorItem.tsx +1 -1
  54. package/dist/components/floorItem.weapp.tsx +1 -1
  55. package/dist/components/isv/Floor/index.tsx +1 -1
  56. package/dist/components/remoteFloorItem.tsx +1 -1
  57. package/dist/interface/common.ts +1 -1
  58. package/dist/interface/component.ts +1 -1
  59. package/dist/interface/jumpEventReport.ts +1 -1
  60. package/dist/interface/service.ts +1 -1
  61. package/dist/interface/utils.ts +1 -1
  62. package/dist/jumpEventReport/base.ts +1 -1
  63. package/dist/jumpEventReport/const.ts +1 -1
  64. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  65. package/dist/jumpEventReport/index.h5.ts +1 -1
  66. package/dist/jumpEventReport/index.jd.ts +1 -1
  67. package/dist/jumpEventReport/index.weapp.ts +1 -1
  68. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  69. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  70. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  71. package/dist/jumpEventReport/web/report.ts +1 -1
  72. package/dist/jumpEventReport/web.base.ts +1 -1
  73. package/dist/jumpEventReport/web.jd.ts +1 -1
  74. package/dist/jumpEventReport/web.jdb.ts +1 -1
  75. package/dist/jumpEventReport/web.jdjch.ts +1 -1
  76. package/dist/jumpEventReport/web.jxwxapp.ts +1 -0
  77. package/dist/jumpEventReport/web.tjapp.ts +1 -0
  78. package/dist/jumpEventReport/web.tjm.ts +1 -0
  79. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  80. package/dist/modules/ContainerFloorList/index.h5.module.scss +18 -1
  81. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  82. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  83. package/dist/open/api/device.ts +1 -1
  84. package/dist/open/api/environment.ts +1 -1
  85. package/dist/open/api/index.ts +1 -1
  86. package/dist/open/api/jump copy.ts +1 -1
  87. package/dist/open/api/request.ts +1 -1
  88. package/dist/open/api/shopMember.ts +1 -1
  89. package/dist/open/api/track.ts +1 -1
  90. package/dist/open/api/util.ts +1 -1
  91. package/dist/open/components/index.ts +1 -1
  92. package/dist/sass/app.h5.scss +49 -3
  93. package/dist/sass/base.scss +57 -0
  94. package/dist/service/fetchGateway.ts +1 -1
  95. package/dist/service/http/colorSign.ts +1 -1
  96. package/dist/service/http/const.ts +1 -1
  97. package/dist/service/http/h5Http.ts +1 -0
  98. package/dist/service/http/index.h5.ts +1 -0
  99. package/dist/service/requestServer.h5.ts +1 -0
  100. package/dist/service/requestServer.ts +1 -1
  101. package/dist/utils/connectNativeJsBridge.ts +1 -1
  102. package/dist/utils/connectNativeJsBridge.weapp.ts +1 -1
  103. package/dist/utils/draExceptionAndProfile.ts +1 -1
  104. package/dist/utils/h5Utils.ts +1 -1
  105. package/dist/utils/index.h5.ts +1 -1
  106. package/dist/utils/index.ts +1 -1
  107. package/dist/utils/index.weapp.ts +1 -1
  108. package/dist/utils/jm-common.js +1 -1
  109. package/dist/utils/sgmCodeUtils.ts +1 -0
  110. package/dist/utils/taroRenderUtil.ts +1 -1
  111. package/dist/utils/utils.ts +1 -1
  112. package/package.json +1 -1
  113. package/dist/customHooks/useDocumentVisibilitychange.ts +0 -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
  (
571
571
  item,
572
572
  floorItem,
573
573
  floorIndex,
574
574
  containerLayoutLeftRightMargin,
575
575
  borderStyle,
576
576
  ) => {
577
577
  return (
578
578
  <View
579
579
  className={classNames(shopContainerListStyle['d-floor-item'])}
580
580
  id={`J_floor_${floorItem?.uid}`}
581
581
  key={floorItem.uid}
582
582
  data-floor-uid={floorItem?.uid}
583
583
  data-floor-type={floorItem?.floorExtInfo?.moduleFlag || ''}
584
584
  style={borderStyle}
585
585
  >
586
586
  <FloorListItem
587
587
  floorIndex={floorIndex}
588
588
  floorData={floorItem}
589
589
  layoutLeftRightMargin={containerLayoutLeftRightMargin}
590
590
  containerBorderRadius={borderStyle}
591
591
  updateShopFloorDataFn={updateShopFloorDataFn}
592
592
  loadingEndComponentFn={loadingEndComponentFn}
593
593
  changeScrollToLowerStateFn={changeScrollToLowerStateFn}
594
594
  key={floorItem.uid}
595
595
  changeScrollTopFn={changeContainerFloorListScrollTop}
596
596
  builtInComponents={builtInComponents}
597
597
  />
598
598
  </View>
599
599
  )
600
600
  },
601
601
  [],
602
602
  )
603
603
  const changeContainerFloorListScrollTop = (top) => {
604
604
  if (miniScrollSelf) {
605
605
  setContainerFloorListScrollTop(top)
606
606
  } else {
607
607
  typeof changeLayoutScrollToTopFn == 'function' &&
608
608
  changeLayoutScrollToTopFn(top)
609
609
  }
610
610
  }
611
611
  const renderContainerList = () => {
612
612
  const listNum = containerFloorList.length || 0
613
613
  const getThisSectionTypeListData =
614
614
  loadSectionTypeContainerFloorListRef.current[`${sectionType}`]
615
615
  return (
616
616
  <View id="J_shopContainerFloorList">
617
617
  {containerFloorListData && containerFloorListData.length > 0 ? (
618
618
  listNum > 0 && (
619
619
  <>
620
620
  {containerFloorList.map((item, index) => {
621
621
  const containerLayoutLeftRightMargin =
622
622
  (item.marginLeft || 0) + (item.marginRight || 0)
623
623
  const getContainerId = `J_container_${item.containerId}`
624
624
  const borderStyle = getBorderStyle(
625
625
  item,
626
626
  index,
627
627
  containerFloorList,
628
628
  listNum,
629
629
  )
630
630
  if (index === listNum - 1) item.marginBottom = 8
631
631
  return (
632
632
  <View
633
633
  className={shopContainerListStyle['d-container-item']}
634
634
  id={getContainerId}
635
635
  key={item.containerId + item.key}
636
636
  style={{
637
637
  marginBottom: item.marginBottom
638
638
  ? `${item.marginBottom}px`
639
639
  : 0,
640
640
  marginTop: item.marginTop ? `${item.marginTop}px` : 0,
641
641
  marginLeft: item.marginLeft ? `${item.marginLeft}px` : 0,
642
642
  marginRight: item.marginRight
643
643
  ? `${item.marginRight}px`
644
644
  : 0,
645
645
  borderTopLeftRadius:
646
646
  borderStyle?.borderTopLeftRadius || `0px`,
647
647
  borderTopRightRadius:
648
648
  borderStyle?.borderTopRightRadiu || `0px`,
649
649
  borderBottomLeftRadius:
650
650
  borderStyle?.borderBottomLeftRadius || `0px`,
651
651
  borderBottomRightRadius:
652
652
  borderStyle?.borderBottomRightRadius || `0px`,
653
653
  }}
654
654
  >
655
655
  {item.floors.length > 0 && (
656
656
  <>
657
657
  {item.floors?.map((floorItem, floorIndex) => {
658
658
  return renderFloorItem(
659
659
  item,
660
660
  floorItem,
661
661
  floorIndex,
662
662
  containerLayoutLeftRightMargin,
663
663
  borderStyle,
664
664
  )
665
665
  })}
666
666
  </>
667
667
  )}
668
668
  </View>
669
669
  )
670
670
  })}
671
671
  {getThisSectionTypeListData.index <
672
672
  getThisSectionTypeListData.max && (
673
673
  <JdLoading localState={true} text="加载中..." />
674
674
  )}
675
675
  {!hasGoodsFeeds &&
676
676
  getThisSectionTypeListData.index >=
677
677
  getThisSectionTypeListData.max &&
678
678
  loadingEndComponentFn &&
679
679
  loadingEndComponentFn()}
680
680
  </>
681
681
  )
682
682
  ) : (
683
683
  <View
684
684
  className={shopContainerListStyle['d-container-list-no-data']}
685
685
  style={{
686
686
  height: `${
687
687
  windowHeight -
688
688
  actualNavBarHeight -
689
689
  MINI_APP_SHOP_HEADER_NAV_BAR_BOTTOM_MENU_HEIGHT +
690
690
  SHOP_TAB_CONTENT_BOTTOM
691
691
  }px`,
692
692
  }}
693
693
  >
694
694
  <NetworkDataError
695
695
  netWorkShowType={NetWorkShowType.PART}
696
696
  netWorkDataType={NETWORK_DATA_TYPE.DATA_ERROR}
697
697
  refreshCallBackFn={updateShopFloorDataFn}
698
698
  />
699
699
  </View>
700
700
  )}
701
701
  </View>
702
702
  )
703
703
  }
704
704
  return miniScrollSelf ? (
705
705
  <ScrollView
706
706
  scrollY
707
707
  scrollTop={containerFloorListScrollTop}
708
708
  className={classNames(
709
709
  className,
710
710
  shopContainerListStyle['d-shop-container-list'],
711
711
  )}
712
712
  onScroll={onScrollRecord}
713
713
  lowerThreshold={windowHeight / 2}
714
714
  onScrollToLower={loadMoreContainerFloorList}
715
715
  style={style}
716
716
  >
717
717
  {tabContentShowState && renderContainerList()}
718
718
  </ScrollView>
719
719
  ) : (
720
720
  <View
721
721
  className={classNames(
722
722
  className,
723
723
  shopContainerListStyle['d-shop-container-list'],
724
724
  )}
725
725
  style={style}
726
726
  >
727
727
  {tabContentShowState && renderContainerList()}
728
728
  </View>
729
729
  )