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