@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.50

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 (99) hide show
  1. package/README.md +1 -1
  2. package/dist/common/accessibility.h5.ts +1 -0
  3. package/dist/common/accessibility.ts +0 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  10. package/dist/common/jssdk.ts +1 -1
  11. package/dist/common/jssdk.weapp.ts +1 -0
  12. package/dist/common/pageType.ts +1 -1
  13. package/dist/common/token/index.h5.ts +1 -1
  14. package/dist/common/token/token.jd.ts +1 -1
  15. package/dist/common/wxappApi.ts +1 -1
  16. package/dist/components/ErrorBoundary.tsx +1 -1
  17. package/dist/components/base/CommonFloorHead/index.module.scss +126 -111
  18. package/dist/components/base/CommonFloorHead/index.tsx +1 -1
  19. package/dist/components/base/CountDown/index.tsx +1 -1
  20. package/dist/components/base/CustomScrollView/index-back.tsx +1 -0
  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/Dialog/index.module.scss +11 -0
  25. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  26. package/dist/components/base/InViewRender/index.tsx +1 -1
  27. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  28. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  30. package/dist/components/base/NetworkDataError/const.ts +1 -1
  31. package/dist/components/base/NetworkDataError/index.module.scss +118 -72
  32. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  33. package/dist/components/base/Price/Base/index.module.scss +12 -0
  34. package/dist/components/base/Price/Base/index.tsx +1 -1
  35. package/dist/components/base/Price/Double/index.module.scss +24 -0
  36. package/dist/components/base/Price/Double/index.tsx +1 -1
  37. package/dist/components/debug/DebugLayout/index.module.scss +2 -2
  38. package/dist/components/floorItem.weapp.tsx +1 -1
  39. package/dist/interface/common.ts +1 -1
  40. package/dist/interface/component.ts +1 -1
  41. package/dist/interface/jumpEventReport.ts +1 -1
  42. package/dist/jumpEventReport/base.ts +1 -1
  43. package/dist/jumpEventReport/const.ts +1 -1
  44. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  45. package/dist/jumpEventReport/index.h5.ts +1 -1
  46. package/dist/jumpEventReport/index.jd.ts +1 -1
  47. package/dist/jumpEventReport/index.weapp.ts +1 -1
  48. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  49. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  50. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  51. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  52. package/dist/jumpEventReport/web/report.ts +1 -1
  53. package/dist/jumpEventReport/web.base.ts +1 -1
  54. package/dist/jumpEventReport/web.jd.ts +1 -1
  55. package/dist/jumpEventReport/web.pc.ts +1 -1
  56. package/dist/jumpEventReport/web.tjm.ts +1 -1
  57. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  58. package/dist/language/en_US.json +231 -0
  59. package/dist/language/zh_CN.json +231 -0
  60. package/dist/language/zh_HK.json +231 -0
  61. package/dist/libs/taroAppReport.js +2 -2
  62. package/dist/modules/ContainerFloorList/index.h5.module.scss +66 -56
  63. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  64. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  65. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  66. package/dist/open/api/environment.ts +1 -1
  67. package/dist/open/api/shopMember.ts +1 -1
  68. package/dist/open/api/shopMember.weapp.ts +1 -0
  69. package/dist/open/api/util.ts +1 -1
  70. package/dist/open/index.ts +1 -1
  71. package/dist/sass/app.h5.scss +278 -224
  72. package/dist/service/fetchGateway.ts +1 -1
  73. package/dist/service/fetchGateway.weapp.ts +1 -0
  74. package/dist/service/fetchJsonp.weapp.ts +1 -0
  75. package/dist/service/http/colorSign.ts +1 -1
  76. package/dist/service/http/const.ts +1 -1
  77. package/dist/service/http/h5Http.ts +1 -1
  78. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  79. package/dist/service/requestServer.h5.ts +1 -1
  80. package/dist/service/requestServer.ts +1 -1
  81. package/dist/service/requestServer.weapp.ts +1 -0
  82. package/dist/utils/connectNativeJsBridge.ts +1 -1
  83. package/dist/utils/h5Utils.ts +1 -1
  84. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  85. package/dist/utils/harmonyCallRouter.ts +0 -0
  86. package/dist/utils/index.h5.ts +1 -1
  87. package/dist/utils/index.ts +1 -1
  88. package/dist/utils/index.weapp.ts +1 -1
  89. package/dist/utils/jumpExtMapUtil.h5.ts +1 -0
  90. package/dist/utils/jumpExtMapUtil.ts +1 -0
  91. package/dist/utils/log.ts +1 -0
  92. package/dist/utils/{sColor.js → sColor.ts} +1 -1
  93. package/dist/utils/sColor.weapp.ts +1 -0
  94. package/dist/utils/utils.ts +1 -1
  95. package/dist/wxapp/common/address_api/address_api_v2.js +1 -0
  96. package/dist/wxapp/common/user_info.js +1 -1
  97. package/package.json +160 -141
  98. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  99. package/dist/utils/priceUtils.js +0 -1
@@ -1 +1 @@
1
- import React, { useRef, useEffect } from 'react';
2
1
  isH5AndJdShopView,
3
2
  isAndroidDevice,
4
3
  isJdAndAndroidDevice,
5
4
  isJdAndIosDevice,
6
5
  isIosDevice,
7
6
  isJdApp,
8
7
  isWxMin,
9
8
  isH5AndJdShopViewH5Scroll,
10
9
  isH5AndJdShopH5CustomScrollView,
11
10
  isH5,
12
11
  isAppClassifyPage,
13
12
  lodashThrottle,
14
13
  START: 'start',
15
14
  MOVE: 'move',
16
15
  END: 'end',
17
16
  const {
18
17
  style = {},
19
18
  scrollX = false,
20
19
  scrollY = false,
21
20
  scrollWithAnimation = true,
22
21
  iosNeedDisableVertical = false,
23
22
  className = null,
24
23
  dispatchTouchMove = true,
25
24
  children,
26
25
  ...otherProps
27
26
  } = props;
28
27
  const rootEleNode = isH5 && document?.querySelector('body');
29
28
  const needShowHighVersion =
30
29
  isH5AndJdShopViewH5Scroll && global.info.queryInfo?.downgraded !== 'true';
31
30
  const mLastClientPosRef = useRef({
32
31
  mLastClientX: 0,
33
32
  mLastClientY: 0,
34
33
  });
35
34
  const isJdAndH5ScrollState = needShowHighVersion || isH5AndJdShopH5CustomScrollView;
36
35
 
37
36
  const touchstartEventBubbleFunc = (e) => {
38
37
  const isH5SwiperCustomEle = e?.target?.closest('.J_h5SwiperCustom');
39
38
  if (!isH5SwiperCustomEle) {
40
39
  const hasCustomEle = e
41
40
  ? e?.target?.closest('.J_customScroll') || e?.target?.closest('.J_customLayout')
42
41
  : false;
43
42
  if (isJdAndAndroidDevice && !hasCustomEle) {
44
43
  window.JdAndroid && window.JdAndroid.requestEvent(false);
45
44
  }
46
45
  !hasCustomEle &&
47
46
  rootEleNode &&
48
47
  rootEleNode.classList.contains('over-hidden') &&
49
48
  rootEleNode.classList.remove('over-hidden');
50
49
  }
51
50
  };
52
51
  const touchstartEventCaptureFunc = (e) => {
53
52
  if (e && !e?.target?.closest('.J_h5SwiperCustom') && !e?.target?.closest('.J_customLayout')) {
54
53
  rootEleNode &&
55
54
  rootEleNode.classList.contains('over-hidden') &&
56
55
  rootEleNode.classList.remove('over-hidden');
57
56
  }
58
57
  };
59
58
  useEffect(() => {
60
59
  isJdApp &&
61
60
  !window.JDJshopViewInfo.getAndroidTouchSlopState &&
62
61
  nativePageGetScaledTouchSlop((res) => {
63
62
  console.log('获取安卓系统滑动阈值', res);
64
63
  window.JDJshopViewInfo.androidTouchSlop = res;
65
64
  window.JDJshopViewInfo.getAndroidTouchSlopState = true;
66
65
  });
67
66
  if (isJdAndH5ScrollState && rootEleNode && !rootEleAddEventListenerState) {
68
67
  global?.removeJdAndroidRquestEventForTouchStart &&
69
68
  global.removeJdAndroidRquestEventForTouchStart();
70
69
  rootEleNode.addEventListener('touchstart', touchstartEventBubbleFunc, false);
71
70
 
72
71
  rootEleNode.addEventListener('touchstart', touchstartEventCaptureFunc, true);
73
72
  rootEleAddEventListenerState = true;
74
73
  console.log('customScrollView 初始化document监听完成');
75
74
  }
76
75
  return () => {
77
76
  if (isJdAndH5ScrollState && rootEleNode && rootEleAddEventListenerState) {
78
77
  console.log('customScrollView document监听取消完成');
79
78
  rootEleNode.removeEventListener('touchstart', touchstartEventBubbleFunc, false);
80
79
  rootEleNode.removeEventListener('touchstart', touchstartEventCaptureFunc, true);
81
80
  }
82
81
  };
83
82
  }, []);
84
83
 
85
84
  const androidDeviceStopNativeScrollEvent = (touchType) => {
86
85
  isJdApp &&
87
86
  isAndroidDevice &&
88
87
  window?.JdAndroid &&
89
88
  window?.JdAndroid.requestEvent(touchType === TouchType.START);
90
89
  };
91
90
  const iosDeviceStopNativeScrollEvent = (e, touchType, sendIosState = true) => {
92
91
  sendIosState && iosDeviceSendRouter(touchType);
93
92
  };
94
93
 
95
94
  const iosDeviceSendRouter = (state: string) => {
96
95
  window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
97
96
  method: 'callRouterModuleWithParams',
98
97
  params: {
99
98
  routerURL: 'router://JDShopModule/processShoph5SlideState',
100
99
  routerParam: {
101
100
  slideDirection: 'horizontal',
102
101
  needDisableVertical: `${iosNeedDisableVertical}`,
103
102
  state,
104
103
  },
105
104
  callBackId: new Date().getTime(),
106
105
  },
107
106
  });
108
107
  };
109
108
  const stopNativeScrollEvent = (e: Event, touchType, sendIosState = true) => {
110
109
  if (isJdApp) {
111
110
  if (isIosDevice && !isAppClassifyPage) {
112
111
  iosDeviceStopNativeScrollEvent(e, touchType, sendIosState);
113
112
  } else if (isAndroidDevice) {
114
113
  androidDeviceStopNativeScrollEvent(touchType);
115
114
  }
116
115
  }
117
116
  };
118
117
 
119
118
  const GetSlideAngle = (dx, dy) => {
120
119
  return (Math.atan2(dy, dx) * 180) / Math.PI;
121
120
  };
122
121
 
123
122
  const GetSlideDirection = (startX, startY, endX, endY) => {
124
123
  const dy = startY - endY;
125
124
  const dx = endX - startX;
126
125
  let result = 0;
127
126
  if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
128
127
  return result;
129
128
  }
130
129
  const angle = GetSlideAngle(dx, dy);
131
130
  if (angle >= -45 && angle < 45) {
132
131
  result = 4;
133
132
  } else if (angle >= 45 && angle < 135) {
134
133
  result = 1;
135
134
  } else if (angle >= -135 && angle < -45) {
136
135
  result = 2;
137
136
  } else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
138
137
  result = 3;
139
138
  }
140
139
  return result;
141
140
  };
142
141
  const changeTouchStart = (e) => {
143
142
  if (isJdApp) {
144
143
  stopNativeScrollEvent(e, TouchType.START, !iosNeedDisableVertical);
145
144
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
146
145
  isJdAndH5ScrollState && rootEleNode && rootEleNode.classList.add('over-hidden');
147
146
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
148
147
  mLastClientPosRef.current.mLastClientX = touchEvent.clientX;
149
148
  mLastClientPosRef.current.mLastClientY = touchEvent.clientY;
150
149
  }
151
150
  }
152
151
  };
153
152
  const changeTouchEnd = (e) => {
154
153
  stopNativeScrollEvent(e, TouchType.END);
155
154
  mLastClientPosRef.current.mLastClientX = 0;
156
155
  mLastClientPosRef.current.mLastClientY = 0;
157
156
  };
158
157
  const triggerIosTouchMove = () => {
159
158
  isJdAndIosDevice && iosDeviceStopNativeScrollEvent(null, TouchType.START, true);
160
159
  };
161
160
 
162
161
  const lodashThrottleTriggerIosTouchMove = lodashThrottle(triggerIosTouchMove, 500);
163
162
 
164
163
  const recoverRootEleVerticalScroll = (touchEvent) => {
165
164
  const direction = GetSlideDirection(
166
165
  mLastClientPosRef.current.mLastClientX,
167
166
  mLastClientPosRef.current.mLastClientY,
168
167
  touchEvent.clientX,
169
168
  touchEvent.clientY,
170
169
  );
171
170
  if (direction === 1 || direction === 2) {
172
171
  rootEleNode &&
173
172
  rootEleNode.classList.contains('over-hidden') &&
174
173
  rootEleNode.classList.remove('over-hidden');
175
174
  }
176
175
  };
177
176
  const changeTouchMove = (e) => {
178
177
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
179
178
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
180
179
  const xDiff = Math.abs(touchEvent.clientX - mLastClientPosRef.current.mLastClientX).toFixed(
181
180
  2,
182
181
  );
183
182
  const yDiff = Math.abs(touchEvent.clientY - mLastClientPosRef.current.mLastClientY).toFixed(
184
183
  2,
185
184
  );
186
185
  if (isJdApp) {
187
186
  if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
188
187
  iosNeedDisableVertical && isJdApp && lodashThrottleTriggerIosTouchMove();
189
188
  } else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
190
189
  stopNativeScrollEvent(e, TouchType.END);
191
190
  }
192
191
  }
193
192
  isJdAndH5ScrollState && recoverRootEleVerticalScroll(touchEvent);
194
193
  }
195
194
  if (!dispatchTouchMove) {
196
195
  return;
197
196
  }
198
197
  const parentNode = e.target?.parentNode;
199
198
  if (!parentNode) {
200
199
  return;
201
200
  }
202
201
  const event = new TouchEvent('touchmove', e);
203
202
  parentNode.dispatchEvent(event);
204
203
  };
205
204
  if (scrollX && isJdApp && !isIgnorePreventNative) {
206
205
  return (
207
206
  <ScrollView
208
207
  scrollX
209
208
  onTouchStart={changeTouchStart}
210
209
  onTouchEnd={changeTouchEnd}
211
210
  onTouchCancel={changeTouchEnd}
212
211
  onTouchMove={changeTouchMove}
213
212
  enhanced
214
213
  showScrollbar={false}
215
214
  style={style}
216
215
  className={classNames(
217
216
  className,
218
217
  {
219
218
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
220
219
  },
221
220
  'J_customScroll',
222
221
  )}
223
222
  scrollY
224
223
  scrollWithAnimation
225
224
  {...otherProps}
226
225
  >
227
226
  {children}
228
227
  </ScrollView>
229
228
  );
230
229
  } else {
231
230
  return (
232
231
  <ScrollView
233
232
  scrollX
234
233
  scrollY
235
234
  scrollWithAnimation
236
235
  enhanced
237
236
  showScrollbar={false}
238
237
  {...otherProps}
239
238
  className={classNames(
240
239
  className,
241
240
  {
242
241
  [customScrollViewStyle['d-custom-ios-mini-extend-border-radius']]:
243
242
  isIosDevice && isWxMin && scrollX && style['borderRadius'],
244
243
  },
245
244
  {
246
245
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
247
246
  },
248
247
  {
249
248
  [customScrollViewStyle['d-custom-mini-hide-scroll']]: isWxMin,
250
249
  },
251
250
  )}
252
251
  style={style}
253
252
  >
254
253
  {children}
255
254
  </ScrollView>
256
255
  );
257
256
  }
257
+ import React, { useRef, useEffect } from 'react';
258
258
  isH5AndJdShopView,
259
259
  isAndroidDevice,
260
260
  isJdAndAndroidDevice,
261
261
  isJdAndHarmonyDevice,
262
262
  isJdAndIosDevice,
263
263
  isIosDevice,
264
264
  isJdApp,
265
265
  isWxMin,
266
266
  isH5AndJdShopViewH5Scroll,
267
267
  isH5AndJdShopH5CustomScrollView,
268
268
  isH5,
269
269
  isAppClassifyPage,
270
270
  lodashThrottle,
271
271
  START: 'start',
272
272
  MOVE: 'move',
273
273
  END: 'end',
274
274
  const {
275
275
  scrollX,
276
276
  children,
277
277
  style = {},
278
278
  iosNeedDisableVertical,
279
279
  dispatchTouchMove,
280
280
  className,
281
281
  ...otherProps
282
282
  } = props;
283
283
  const rootEleNode = isH5 && document ? document.querySelector('body') : null;
284
284
  const needShowHighVersion =
285
285
  isH5AndJdShopViewH5Scroll &&
286
286
  !(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === 'true');
287
287
  const mLastClientPosRef = useRef({
288
288
  mLastClientX: 0,
289
289
  mLastClientY: 0,
290
290
  });
291
291
  const isJdAndH5ScrollState = needShowHighVersion || isH5AndJdShopH5CustomScrollView;
292
292
 
293
293
  const touchstartEventBubbleFunc = (e) => {
294
294
  const isH5SwiperCustomEle = e?.target?.closest('.J_h5SwiperCustom');
295
295
  if (!isH5SwiperCustomEle) {
296
296
  const hasCustomEle = e
297
297
  ? e?.target?.closest('.J_customScroll') || e?.target?.closest('.J_customLayout')
298
298
  : false;
299
299
  if (isJdAndAndroidDevice && !hasCustomEle) {
300
300
  window?.JdAndroid &&
301
301
  window?.JdAndroid?.requestEvent &&
302
302
  window.JdAndroid.requestEvent(false);
303
303
  }
304
304
  !hasCustomEle &&
305
305
  rootEleNode &&
306
306
  rootEleNode.classList.contains('over-hidden') &&
307
307
  rootEleNode.classList.remove('over-hidden');
308
308
  console.log(
309
309
  'customScrollView所在页面document touch start事件是否有J_customScroll元素',
310
310
  hasCustomEle,
311
311
  '根元素是否有over-hidden',
312
312
  rootEleNode.classList,
313
313
  );
314
314
  }
315
315
  };
316
316
  const touchstartEventCaptureFunc = (e) => {
317
317
  if (e && !e?.target?.closest('.J_h5SwiperCustom') && !e?.target?.closest('.J_customLayout')) {
318
318
  rootEleNode &&
319
319
  rootEleNode.classList.contains('over-hidden') &&
320
320
  rootEleNode.classList.remove('over-hidden');
321
321
  console.log(
322
322
  'customScrollView所在页面document touch start事件捕获阶段移除根元素是否有over-hidden',
323
323
  rootEleNode.classList,
324
324
  );
325
325
  }
326
326
  };
327
327
  useEffect(() => {
328
328
  isJdApp &&
329
329
  !window.JDJshopViewInfo.getAndroidTouchSlopState &&
330
330
  nativePageGetScaledTouchSlop((res) => {
331
331
  console.log('获取安卓系统滑动阈值', res);
332
332
  window.JDJshopViewInfo.androidTouchSlop = res;
333
333
  window.JDJshopViewInfo.getAndroidTouchSlopState = true;
334
334
  });
335
335
  if (isJdAndH5ScrollState && rootEleNode && !rootEleAddEventListenerState) {
336
336
  global?.removeJdAndroidRquestEventForTouchStart &&
337
337
  global.removeJdAndroidRquestEventForTouchStart();
338
338
  rootEleNode.addEventListener('touchstart', touchstartEventBubbleFunc, false);
339
339
 
340
340
  rootEleNode.addEventListener('touchstart', touchstartEventCaptureFunc, true);
341
341
  rootEleAddEventListenerState = true;
342
342
  console.log('customScrollView 初始化document监听完成');
343
343
  }
344
344
  return () => {
345
345
  if (isJdAndH5ScrollState && rootEleNode && rootEleAddEventListenerState) {
346
346
  console.log('customScrollView document监听取消完成');
347
347
  rootEleNode.removeEventListener('touchstart', touchstartEventBubbleFunc, false);
348
348
  rootEleNode.removeEventListener('touchstart', touchstartEventCaptureFunc, true);
349
349
  }
350
350
  };
351
351
  }, []);
352
352
 
353
353
  const androidDeviceStopNativeScrollEvent = (touchType) => {
354
354
  isJdApp &&
355
355
  isAndroidDevice &&
356
356
  window?.JdAndroid &&
357
357
  window?.JdAndroid?.requestEvent &&
358
358
  window.JdAndroid.requestEvent(touchType === TouchType.START);
359
359
  console.log('触发window?.JdAndroid.requestEvent', touchType === TouchType.START, touchType);
360
360
  };
361
361
  const iosDeviceStopNativeScrollEvent = (e, touchType, sendIosState = true) => {
362
362
  sendIosState && iosDeviceSendRouter(touchType);
363
363
  };
364
364
 
365
365
  const iosDeviceSendRouter = (state: string) => {
366
366
  window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
367
367
  method: 'callRouterModuleWithParams',
368
368
  params: {
369
369
  routerURL: 'router://JDShopModule/processShoph5SlideState',
370
370
  routerParam: {
371
371
  slideDirection: 'horizontal',
372
372
  needDisableVertical: `${iosNeedDisableVertical}`,
373
373
  state,
374
374
  },
375
375
  callBackId: new Date().getTime(),
376
376
  },
377
377
  });
378
378
  };
379
379
  const stopNativeScrollEvent = (e: Event, touchType, sendIosState = true) => {
380
380
  if (isJdApp) {
381
381
  isIosDevice &&
382
382
  !isAppClassifyPage &&
383
383
  iosDeviceStopNativeScrollEvent(e, touchType, sendIosState);
384
384
  isAndroidDevice && androidDeviceStopNativeScrollEvent(touchType);
385
385
  }
386
386
  };
387
387
 
388
388
  const GetSlideAngle = (dx, dy) => {
389
389
  return (Math.atan2(dy, dx) * 180) / Math.PI;
390
390
  };
391
391
 
392
392
  const GetSlideDirection = (startX, startY, endX, endY) => {
393
393
  const dy = startY - endY;
394
394
  const dx = endX - startX;
395
395
  let result = 0;
396
396
  if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
397
397
  return result;
398
398
  }
399
399
  const angle = GetSlideAngle(dx, dy);
400
400
  if (angle >= -45 && angle < 45) {
401
401
  result = 4;
402
402
  } else if (angle >= 45 && angle < 135) {
403
403
  result = 1;
404
404
  } else if (angle >= -135 && angle < -45) {
405
405
  result = 2;
406
406
  } else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
407
407
  result = 3;
408
408
  }
409
409
  return result;
410
410
  };
411
411
  const changeTouchStart = (e) => {
412
412
  if (isJdApp) {
413
413
  stopNativeScrollEvent(e, TouchType.START, !iosNeedDisableVertical);
414
414
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
415
415
  isJdAndH5ScrollState && rootEleNode && rootEleNode.classList.add('over-hidden');
416
416
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
417
417
  mLastClientPosRef.current.mLastClientX = touchEvent.clientX;
418
418
  mLastClientPosRef.current.mLastClientY = touchEvent.clientY;
419
419
  }
420
420
  }
421
421
  };
422
422
  const changeTouchEnd = (e) => {
423
423
  stopNativeScrollEvent(e, TouchType.END);
424
424
  mLastClientPosRef.current.mLastClientX = 0;
425
425
  mLastClientPosRef.current.mLastClientY = 0;
426
426
  };
427
427
  const triggerIosTouchMove = () => {
428
428
  isJdAndIosDevice && iosDeviceStopNativeScrollEvent(null, TouchType.START, true);
429
429
  };
430
430
 
431
431
  const lodashThrottleTriggerIosTouchMove = lodashThrottle(triggerIosTouchMove, 500);
432
432
 
433
433
  const recoverRootEleVerticalScroll = (touchEvent) => {
434
434
  const direction = GetSlideDirection(
435
435
  mLastClientPosRef.current.mLastClientX,
436
436
  mLastClientPosRef.current.mLastClientY,
437
437
  touchEvent.clientX,
438
438
  touchEvent.clientY,
439
439
  );
440
440
  if (direction === 1 || direction === 2) {
441
441
  rootEleNode &&
442
442
  rootEleNode.classList.contains('over-hidden') &&
443
443
  rootEleNode.classList.remove('over-hidden');
444
444
  }
445
445
  };
446
446
  const changeTouchMove = (e) => {
447
447
  if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
448
448
  const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
449
449
  const xDiff = Math.abs(touchEvent.clientX - mLastClientPosRef.current.mLastClientX).toFixed(
450
450
  2,
451
451
  );
452
452
  const yDiff = Math.abs(touchEvent.clientY - mLastClientPosRef.current.mLastClientY).toFixed(
453
453
  2,
454
454
  );
455
455
  if (isJdApp) {
456
456
  if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
457
457
  iosNeedDisableVertical && isJdApp && lodashThrottleTriggerIosTouchMove();
458
458
  } else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
459
459
  console.log('纵向滚动触发', yDiff, touchEvent, window.JDJshopViewInfo.androidTouchSlop);
460
460
  stopNativeScrollEvent(e, TouchType.END);
461
461
  }
462
462
  }
463
463
  isJdAndH5ScrollState && recoverRootEleVerticalScroll(touchEvent);
464
464
  }
465
465
  if (!dispatchTouchMove) {
466
466
  return;
467
467
  }
468
468
  const parentNode = e.target?.parentNode;
469
469
  if (!parentNode) {
470
470
  return;
471
471
  }
472
472
  const event = new TouchEvent('touchmove', e);
473
473
  parentNode.dispatchEvent(event);
474
474
  };
475
475
  if (scrollX && isJdApp && !isIgnorePreventNative) {
476
476
  return (
477
477
  <ScrollView
478
478
  scrollX
479
479
  onTouchStart={changeTouchStart}
480
480
  onTouchEnd={changeTouchEnd}
481
481
  onTouchCancel={changeTouchEnd}
482
482
  onTouchMove={changeTouchMove}
483
483
  enhanced
484
484
  showScrollbar={false}
485
485
  style={style}
486
486
  className={classNames(
487
487
  className,
488
488
  {
489
489
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
490
490
  },
491
491
  'J_customScroll',
492
492
  )}
493
493
  {...otherProps}
494
494
  >
495
495
  {children}
496
496
  </ScrollView>
497
497
  );
498
498
  } else {
499
499
  return (
500
500
  <ScrollView
501
501
  scrollX
502
502
  enhanced
503
503
  showScrollbar={false}
504
504
  {...otherProps}
505
505
  className={classNames(
506
506
  className,
507
507
  {
508
508
  [customScrollViewStyle['d-custom-ios-mini-extend-border-radius']]:
509
509
  isIosDevice && isWxMin && scrollX && style['borderRadius'],
510
510
  },
511
511
  {
512
512
  [customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
513
513
  },
514
514
  {
515
515
  [customScrollViewStyle['d-custom-mini-hide-scroll']]: isWxMin,
516
516
  },
517
517
  )}
518
518
  style={style}
519
519
  >
520
520
  {children}
521
521
  </ScrollView>
522
522
  );
523
523
  }
524
524
  style: {},
525
525
  scrollX: false,
526
526
  scrollY: false,
527
527
  scrollWithAnimation: true,
528
528
  iosNeedDisableVertical: false,
529
529
  className: null,
530
530
  dispatchTouchMove: true,