@conecli/cone-render 0.10.1-isv2.1 → 0.10.1-isv2.4

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