@conecli/cone-render 0.10.1-shop3.1 → 0.10.1-shop3.100

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