@conecli/cone-render 0.10.1-shop-beta.11 → 0.10.1-shop-beta.13

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