@conecli/cone-render 0.9.1-shop2.4 → 0.9.1-shop2.40

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