@conecli/cone-render 0.10.1-shop3.9 → 0.10.1-shop3.90

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