@conecli/cone-render 0.10.1-shop-beta.45 → 0.10.1-shop-beta.47
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
import React, { useRef, useEffect } from 'react';
|
|
2
1
|
isH5AndJdShopView,
|
|
3
2
|
isAndroidDevice,
|
|
4
3
|
isJdAndAndroidDevice,
|
|
5
4
|
isJdAndHarmonyDevice,
|
|
6
5
|
isJdAndIosDevice,
|
|
7
6
|
isIosDevice,
|
|
8
7
|
isJdApp,
|
|
9
8
|
isWxMin,
|
|
10
9
|
isH5AndJdShopViewH5Scroll,
|
|
11
10
|
isH5AndJdShopH5CustomScrollView,
|
|
12
11
|
isH5,
|
|
13
12
|
isAppClassifyPage,
|
|
14
13
|
lodashThrottle,
|
|
15
14
|
START: 'start',
|
|
16
15
|
MOVE: 'move',
|
|
17
16
|
END: 'end',
|
|
18
17
|
const {
|
|
19
18
|
scrollX,
|
|
20
19
|
children,
|
|
21
20
|
style = {},
|
|
22
21
|
iosNeedDisableVertical,
|
|
23
22
|
dispatchTouchMove,
|
|
24
23
|
className,
|
|
25
24
|
...otherProps
|
|
26
25
|
} = props;
|
|
27
26
|
const rootEleNode = isH5 && document ? document.querySelector('body') : null;
|
|
28
27
|
const needShowHighVersion =
|
|
29
28
|
isH5AndJdShopViewH5Scroll &&
|
|
30
29
|
!(global.info.queryInfo?.downgraded && 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 &&
|
|
45
44
|
window?.JdAndroid?.requestEvent &&
|
|
46
45
|
window.JdAndroid.requestEvent(false);
|
|
47
46
|
}
|
|
48
47
|
!hasCustomEle &&
|
|
49
48
|
rootEleNode &&
|
|
50
49
|
rootEleNode.classList.contains('over-hidden') &&
|
|
51
50
|
rootEleNode.classList.remove('over-hidden');
|
|
52
51
|
console.log(
|
|
53
52
|
'customScrollView所在页面document touch start事件是否有J_customScroll元素',
|
|
54
53
|
hasCustomEle,
|
|
55
54
|
'根元素是否有over-hidden',
|
|
56
55
|
rootEleNode.classList,
|
|
57
56
|
);
|
|
58
57
|
}
|
|
59
58
|
};
|
|
60
59
|
const touchstartEventCaptureFunc = (e) => {
|
|
61
60
|
if (e && !e?.target?.closest('.J_h5SwiperCustom') && !e?.target?.closest('.J_customLayout')) {
|
|
62
61
|
rootEleNode &&
|
|
63
62
|
rootEleNode.classList.contains('over-hidden') &&
|
|
64
63
|
rootEleNode.classList.remove('over-hidden');
|
|
65
64
|
console.log(
|
|
66
65
|
'customScrollView所在页面document touch start事件捕获阶段移除根元素是否有over-hidden',
|
|
67
66
|
rootEleNode.classList,
|
|
68
67
|
);
|
|
69
68
|
}
|
|
70
69
|
};
|
|
71
70
|
useEffect(() => {
|
|
72
71
|
isJdApp &&
|
|
73
72
|
!window.JDJshopViewInfo.getAndroidTouchSlopState &&
|
|
74
73
|
nativePageGetScaledTouchSlop((res) => {
|
|
75
74
|
console.log('获取安卓系统滑动阈值', res);
|
|
76
75
|
window.JDJshopViewInfo.androidTouchSlop = res;
|
|
77
76
|
window.JDJshopViewInfo.getAndroidTouchSlopState = true;
|
|
78
77
|
});
|
|
79
78
|
if (isJdAndH5ScrollState && rootEleNode && !rootEleAddEventListenerState) {
|
|
80
79
|
global?.removeJdAndroidRquestEventForTouchStart &&
|
|
81
80
|
global.removeJdAndroidRquestEventForTouchStart();
|
|
82
81
|
rootEleNode.addEventListener('touchstart', touchstartEventBubbleFunc, false);
|
|
83
82
|
|
|
84
83
|
rootEleNode.addEventListener('touchstart', touchstartEventCaptureFunc, true);
|
|
85
84
|
rootEleAddEventListenerState = true;
|
|
86
85
|
console.log('customScrollView 初始化document监听完成');
|
|
87
86
|
}
|
|
88
87
|
return () => {
|
|
89
88
|
if (isJdAndH5ScrollState && rootEleNode && rootEleAddEventListenerState) {
|
|
90
89
|
console.log('customScrollView document监听取消完成');
|
|
91
90
|
rootEleNode.removeEventListener('touchstart', touchstartEventBubbleFunc, false);
|
|
92
91
|
rootEleNode.removeEventListener('touchstart', touchstartEventCaptureFunc, true);
|
|
93
92
|
}
|
|
94
93
|
};
|
|
95
94
|
}, []);
|
|
96
95
|
|
|
97
96
|
const androidDeviceStopNativeScrollEvent = (touchType) => {
|
|
98
97
|
isJdApp &&
|
|
99
98
|
isAndroidDevice &&
|
|
100
99
|
window?.JdAndroid &&
|
|
101
100
|
window?.JdAndroid?.requestEvent &&
|
|
102
101
|
window.JdAndroid.requestEvent(touchType === TouchType.START);
|
|
103
102
|
console.log('触发window?.JdAndroid.requestEvent', touchType === TouchType.START, touchType);
|
|
104
103
|
};
|
|
105
104
|
const iosDeviceStopNativeScrollEvent = (e, touchType, sendIosState = true) => {
|
|
106
105
|
sendIosState && iosDeviceSendRouter(touchType);
|
|
107
106
|
};
|
|
108
107
|
|
|
109
108
|
const iosDeviceSendRouter = (state: string) => {
|
|
110
109
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
111
110
|
method: 'callRouterModuleWithParams',
|
|
112
111
|
params: {
|
|
113
112
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
114
113
|
routerParam: {
|
|
115
114
|
slideDirection: 'horizontal',
|
|
116
115
|
needDisableVertical: `${iosNeedDisableVertical}`,
|
|
117
116
|
state,
|
|
118
117
|
},
|
|
119
118
|
callBackId: new Date().getTime(),
|
|
120
119
|
},
|
|
121
120
|
});
|
|
122
121
|
};
|
|
123
122
|
const stopNativeScrollEvent = (e: Event, touchType, sendIosState = true) => {
|
|
124
123
|
if (isJdApp) {
|
|
125
124
|
isIosDevice &&
|
|
126
125
|
!isAppClassifyPage &&
|
|
127
126
|
iosDeviceStopNativeScrollEvent(e, touchType, sendIosState);
|
|
128
127
|
isAndroidDevice && androidDeviceStopNativeScrollEvent(touchType);
|
|
129
128
|
}
|
|
130
129
|
};
|
|
131
130
|
|
|
132
131
|
const GetSlideAngle = (dx, dy) => {
|
|
133
132
|
return (Math.atan2(dy, dx) * 180) / Math.PI;
|
|
134
133
|
};
|
|
135
134
|
|
|
136
135
|
const GetSlideDirection = (startX, startY, endX, endY) => {
|
|
137
136
|
const dy = startY - endY;
|
|
138
137
|
const dx = endX - startX;
|
|
139
138
|
let result = 0;
|
|
140
139
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
141
140
|
return result;
|
|
142
141
|
}
|
|
143
142
|
const angle = GetSlideAngle(dx, dy);
|
|
144
143
|
if (angle >= -45 && angle < 45) {
|
|
145
144
|
result = 4;
|
|
146
145
|
} else if (angle >= 45 && angle < 135) {
|
|
147
146
|
result = 1;
|
|
148
147
|
} else if (angle >= -135 && angle < -45) {
|
|
149
148
|
result = 2;
|
|
150
149
|
} else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
151
150
|
result = 3;
|
|
152
151
|
}
|
|
153
152
|
return result;
|
|
154
153
|
};
|
|
155
154
|
const changeTouchStart = (e) => {
|
|
156
155
|
if (isJdApp) {
|
|
157
156
|
stopNativeScrollEvent(e, TouchType.START, !iosNeedDisableVertical);
|
|
158
157
|
if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
|
|
159
158
|
isJdAndH5ScrollState && rootEleNode && rootEleNode.classList.add('over-hidden');
|
|
160
159
|
const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
|
|
161
160
|
mLastClientPosRef.current.mLastClientX = touchEvent.clientX;
|
|
162
161
|
mLastClientPosRef.current.mLastClientY = touchEvent.clientY;
|
|
163
162
|
}
|
|
164
163
|
}
|
|
165
164
|
};
|
|
166
165
|
const changeTouchEnd = (e) => {
|
|
167
166
|
stopNativeScrollEvent(e, TouchType.END);
|
|
168
167
|
mLastClientPosRef.current.mLastClientX = 0;
|
|
169
168
|
mLastClientPosRef.current.mLastClientY = 0;
|
|
170
169
|
};
|
|
171
170
|
const triggerIosTouchMove = () => {
|
|
172
171
|
isJdAndIosDevice && iosDeviceStopNativeScrollEvent(null, TouchType.START, true);
|
|
173
172
|
};
|
|
174
173
|
|
|
175
174
|
const lodashThrottleTriggerIosTouchMove = lodashThrottle(triggerIosTouchMove, 500);
|
|
176
175
|
|
|
177
176
|
const recoverRootEleVerticalScroll = (touchEvent) => {
|
|
178
177
|
const direction = GetSlideDirection(
|
|
179
178
|
mLastClientPosRef.current.mLastClientX,
|
|
180
179
|
mLastClientPosRef.current.mLastClientY,
|
|
181
180
|
touchEvent.clientX,
|
|
182
181
|
touchEvent.clientY,
|
|
183
182
|
);
|
|
184
183
|
if (direction === 1 || direction === 2) {
|
|
185
184
|
rootEleNode &&
|
|
186
185
|
rootEleNode.classList.contains('over-hidden') &&
|
|
187
186
|
rootEleNode.classList.remove('over-hidden');
|
|
188
187
|
}
|
|
189
188
|
};
|
|
190
189
|
const changeTouchMove = (e) => {
|
|
191
190
|
if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
|
|
192
191
|
const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
|
|
193
192
|
const xDiff = Math.abs(touchEvent.clientX - mLastClientPosRef.current.mLastClientX).toFixed(
|
|
194
193
|
2,
|
|
195
194
|
);
|
|
196
195
|
const yDiff = Math.abs(touchEvent.clientY - mLastClientPosRef.current.mLastClientY).toFixed(
|
|
197
196
|
2,
|
|
198
197
|
);
|
|
199
198
|
if (isJdApp) {
|
|
200
199
|
if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
|
|
201
200
|
iosNeedDisableVertical && isJdApp && lodashThrottleTriggerIosTouchMove();
|
|
202
201
|
} else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
|
|
203
202
|
console.log('纵向滚动触发', yDiff, touchEvent, window.JDJshopViewInfo.androidTouchSlop);
|
|
204
203
|
stopNativeScrollEvent(e, TouchType.END);
|
|
205
204
|
}
|
|
206
205
|
}
|
|
207
206
|
isJdAndH5ScrollState && recoverRootEleVerticalScroll(touchEvent);
|
|
208
207
|
}
|
|
209
208
|
if (!dispatchTouchMove) {
|
|
210
209
|
return;
|
|
211
210
|
}
|
|
212
211
|
const parentNode = e.target?.parentNode;
|
|
213
212
|
if (!parentNode) {
|
|
214
213
|
return;
|
|
215
214
|
}
|
|
216
215
|
const event = new TouchEvent('touchmove', e);
|
|
217
216
|
parentNode.dispatchEvent(event);
|
|
218
217
|
};
|
|
219
218
|
if (scrollX && isJdApp && !isIgnorePreventNative) {
|
|
220
219
|
return (
|
|
221
220
|
<ScrollView
|
|
222
221
|
scrollX
|
|
223
222
|
onTouchStart={changeTouchStart}
|
|
224
223
|
onTouchEnd={changeTouchEnd}
|
|
225
224
|
onTouchCancel={changeTouchEnd}
|
|
226
225
|
onTouchMove={changeTouchMove}
|
|
227
226
|
enhanced
|
|
228
227
|
showScrollbar={false}
|
|
229
228
|
style={style}
|
|
230
229
|
className={classNames(
|
|
231
230
|
className,
|
|
232
231
|
{
|
|
233
232
|
[customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
|
|
234
233
|
},
|
|
235
234
|
'J_customScroll',
|
|
236
235
|
)}
|
|
237
236
|
{...otherProps}
|
|
238
237
|
>
|
|
239
238
|
{children}
|
|
240
239
|
</ScrollView>
|
|
241
240
|
);
|
|
242
241
|
} else {
|
|
243
242
|
return (
|
|
244
243
|
<ScrollView
|
|
245
244
|
scrollX
|
|
246
245
|
enhanced
|
|
247
246
|
showScrollbar={false}
|
|
248
247
|
{...otherProps}
|
|
249
248
|
className={classNames(
|
|
250
249
|
className,
|
|
251
250
|
{
|
|
252
251
|
[customScrollViewStyle['d-custom-ios-mini-extend-border-radius']]:
|
|
253
252
|
isIosDevice && isWxMin && scrollX && style['borderRadius'],
|
|
254
253
|
},
|
|
255
254
|
{
|
|
256
255
|
[customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
|
|
257
256
|
},
|
|
258
257
|
{
|
|
259
258
|
[customScrollViewStyle['d-custom-mini-hide-scroll']]: isWxMin,
|
|
260
259
|
},
|
|
261
260
|
)}
|
|
262
261
|
style={style}
|
|
263
262
|
>
|
|
264
263
|
{children}
|
|
265
264
|
</ScrollView>
|
|
266
265
|
);
|
|
267
266
|
}
|
|
268
267
|
style: {},
|
|
269
268
|
scrollX: false,
|
|
270
269
|
scrollY: false,
|
|
271
270
|
scrollWithAnimation: true,
|
|
272
271
|
iosNeedDisableVertical: false,
|
|
273
272
|
className: null,
|
|
274
273
|
dispatchTouchMove: true,
|
|
274
|
+
import React, { useRef, useEffect } from 'react';
|
|
275
275
|
isH5AndJdShopView,
|
|
276
276
|
isAndroidDevice,
|
|
277
277
|
isJdAndAndroidDevice,
|
|
278
278
|
isJdAndHarmonyDevice,
|
|
279
279
|
isJdAndIosDevice,
|
|
280
280
|
isIosDevice,
|
|
281
281
|
isJdApp,
|
|
282
282
|
isWxMin,
|
|
283
283
|
isH5AndJdShopViewH5Scroll,
|
|
284
284
|
isH5AndJdShopH5CustomScrollView,
|
|
285
285
|
isH5,
|
|
286
286
|
isAppClassifyPage,
|
|
287
287
|
lodashThrottle,
|
|
288
288
|
START: 'start',
|
|
289
289
|
MOVE: 'move',
|
|
290
290
|
END: 'end',
|
|
291
291
|
const {
|
|
292
292
|
scrollX,
|
|
293
293
|
children,
|
|
294
294
|
style = {},
|
|
295
295
|
iosNeedDisableVertical,
|
|
296
296
|
dispatchTouchMove,
|
|
297
297
|
className,
|
|
298
298
|
...otherProps
|
|
299
299
|
} = props;
|
|
300
300
|
const rootEleNode = isH5 && document ? document.querySelector('body') : null;
|
|
301
301
|
const needShowHighVersion =
|
|
302
302
|
isH5AndJdShopViewH5Scroll &&
|
|
303
303
|
!(global.info.queryInfo?.downgraded && global.info.queryInfo.downgraded === 'true');
|
|
304
304
|
const mLastClientPosRef = useRef({
|
|
305
305
|
mLastClientX: 0,
|
|
306
306
|
mLastClientY: 0,
|
|
307
307
|
});
|
|
308
308
|
const isJdAndH5ScrollState = needShowHighVersion || isH5AndJdShopH5CustomScrollView;
|
|
309
309
|
|
|
310
310
|
const touchstartEventBubbleFunc = (e) => {
|
|
311
311
|
const isH5SwiperCustomEle = e?.target?.closest('.J_h5SwiperCustom');
|
|
312
312
|
if (!isH5SwiperCustomEle) {
|
|
313
313
|
const hasCustomEle = e
|
|
314
314
|
? e?.target?.closest('.J_customScroll') || e?.target?.closest('.J_customLayout')
|
|
315
315
|
: false;
|
|
316
316
|
if (isJdAndAndroidDevice && !hasCustomEle) {
|
|
317
317
|
window?.JdAndroid &&
|
|
318
318
|
window?.JdAndroid?.requestEvent &&
|
|
319
319
|
window.JdAndroid.requestEvent(false);
|
|
320
320
|
}
|
|
321
321
|
!hasCustomEle &&
|
|
322
322
|
rootEleNode &&
|
|
323
323
|
rootEleNode.classList.contains('over-hidden') &&
|
|
324
324
|
rootEleNode.classList.remove('over-hidden');
|
|
325
325
|
console.log(
|
|
326
326
|
'customScrollView所在页面document touch start事件是否有J_customScroll元素',
|
|
327
327
|
hasCustomEle,
|
|
328
328
|
'根元素是否有over-hidden',
|
|
329
329
|
rootEleNode.classList,
|
|
330
330
|
);
|
|
331
331
|
}
|
|
332
332
|
};
|
|
333
333
|
const touchstartEventCaptureFunc = (e) => {
|
|
334
334
|
if (e && !e?.target?.closest('.J_h5SwiperCustom') && !e?.target?.closest('.J_customLayout')) {
|
|
335
335
|
rootEleNode &&
|
|
336
336
|
rootEleNode.classList.contains('over-hidden') &&
|
|
337
337
|
rootEleNode.classList.remove('over-hidden');
|
|
338
338
|
console.log(
|
|
339
339
|
'customScrollView所在页面document touch start事件捕获阶段移除根元素是否有over-hidden',
|
|
340
340
|
rootEleNode.classList,
|
|
341
341
|
);
|
|
342
342
|
}
|
|
343
343
|
};
|
|
344
344
|
useEffect(() => {
|
|
345
345
|
isJdApp &&
|
|
346
346
|
!window.JDJshopViewInfo.getAndroidTouchSlopState &&
|
|
347
347
|
nativePageGetScaledTouchSlop((res) => {
|
|
348
348
|
console.log('获取安卓系统滑动阈值', res);
|
|
349
349
|
window.JDJshopViewInfo.androidTouchSlop = res;
|
|
350
350
|
window.JDJshopViewInfo.getAndroidTouchSlopState = true;
|
|
351
351
|
});
|
|
352
352
|
if (isJdAndH5ScrollState && rootEleNode && !rootEleAddEventListenerState) {
|
|
353
353
|
global?.removeJdAndroidRquestEventForTouchStart &&
|
|
354
354
|
global.removeJdAndroidRquestEventForTouchStart();
|
|
355
355
|
rootEleNode.addEventListener('touchstart', touchstartEventBubbleFunc, false);
|
|
356
356
|
|
|
357
357
|
rootEleNode.addEventListener('touchstart', touchstartEventCaptureFunc, true);
|
|
358
358
|
rootEleAddEventListenerState = true;
|
|
359
359
|
console.log('customScrollView 初始化document监听完成');
|
|
360
360
|
}
|
|
361
361
|
return () => {
|
|
362
362
|
if (isJdAndH5ScrollState && rootEleNode && rootEleAddEventListenerState) {
|
|
363
363
|
rootEleNode.classList.contains('over-hidden') &&
|
|
364
364
|
rootEleNode.classList.remove('over-hidden');
|
|
365
365
|
rootEleAddEventListenerState = false;
|
|
366
366
|
console.log('customScrollView document监听取消完成');
|
|
367
367
|
rootEleNode.removeEventListener('touchstart', touchstartEventBubbleFunc, false);
|
|
368
368
|
rootEleNode.removeEventListener('touchstart', touchstartEventCaptureFunc, true);
|
|
369
369
|
}
|
|
370
370
|
};
|
|
371
371
|
}, []);
|
|
372
372
|
|
|
373
373
|
const androidDeviceStopNativeScrollEvent = (touchType) => {
|
|
374
374
|
isJdApp &&
|
|
375
375
|
isAndroidDevice &&
|
|
376
376
|
window?.JdAndroid &&
|
|
377
377
|
window?.JdAndroid?.requestEvent &&
|
|
378
378
|
window.JdAndroid.requestEvent(touchType === TouchType.START);
|
|
379
379
|
console.log('触发window?.JdAndroid.requestEvent', touchType === TouchType.START, touchType);
|
|
380
380
|
};
|
|
381
381
|
const iosDeviceStopNativeScrollEvent = (e, touchType, sendIosState = true) => {
|
|
382
382
|
sendIosState && iosDeviceSendRouter(touchType);
|
|
383
383
|
};
|
|
384
384
|
|
|
385
385
|
const iosDeviceSendRouter = (state: string) => {
|
|
386
386
|
window?.webkit?.messageHandlers?.MobileNavi?.postMessage?.({
|
|
387
387
|
method: 'callRouterModuleWithParams',
|
|
388
388
|
params: {
|
|
389
389
|
routerURL: 'router://JDShopModule/processShoph5SlideState',
|
|
390
390
|
routerParam: {
|
|
391
391
|
slideDirection: 'horizontal',
|
|
392
392
|
needDisableVertical: `${iosNeedDisableVertical}`,
|
|
393
393
|
state,
|
|
394
394
|
},
|
|
395
395
|
callBackId: new Date().getTime(),
|
|
396
396
|
},
|
|
397
397
|
});
|
|
398
398
|
};
|
|
399
399
|
const stopNativeScrollEvent = (e: Event, touchType, sendIosState = true) => {
|
|
400
400
|
if (isJdApp) {
|
|
401
401
|
isIosDevice &&
|
|
402
402
|
!isAppClassifyPage &&
|
|
403
403
|
iosDeviceStopNativeScrollEvent(e, touchType, sendIosState);
|
|
404
404
|
isAndroidDevice && androidDeviceStopNativeScrollEvent(touchType);
|
|
405
405
|
}
|
|
406
406
|
};
|
|
407
407
|
|
|
408
408
|
const GetSlideAngle = (dx, dy) => {
|
|
409
409
|
return (Math.atan2(dy, dx) * 180) / Math.PI;
|
|
410
410
|
};
|
|
411
411
|
|
|
412
412
|
const GetSlideDirection = (startX, startY, endX, endY) => {
|
|
413
413
|
const dy = startY - endY;
|
|
414
414
|
const dx = endX - startX;
|
|
415
415
|
let result = 0;
|
|
416
416
|
if (Math.abs(dx) < 2 && Math.abs(dy) < 2) {
|
|
417
417
|
return result;
|
|
418
418
|
}
|
|
419
419
|
const angle = GetSlideAngle(dx, dy);
|
|
420
420
|
if (angle >= -45 && angle < 45) {
|
|
421
421
|
result = 4;
|
|
422
422
|
} else if (angle >= 45 && angle < 135) {
|
|
423
423
|
result = 1;
|
|
424
424
|
} else if (angle >= -135 && angle < -45) {
|
|
425
425
|
result = 2;
|
|
426
426
|
} else if ((angle >= 135 && angle <= 180) || (angle >= -180 && angle < -135)) {
|
|
427
427
|
result = 3;
|
|
428
428
|
}
|
|
429
429
|
return result;
|
|
430
430
|
};
|
|
431
431
|
const changeTouchStart = (e) => {
|
|
432
432
|
if (isJdApp) {
|
|
433
433
|
stopNativeScrollEvent(e, TouchType.START, !iosNeedDisableVertical);
|
|
434
434
|
if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
|
|
435
435
|
isJdAndH5ScrollState && rootEleNode && rootEleNode.classList.add('over-hidden');
|
|
436
436
|
const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
|
|
437
437
|
mLastClientPosRef.current.mLastClientX = touchEvent.clientX;
|
|
438
438
|
mLastClientPosRef.current.mLastClientY = touchEvent.clientY;
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
441
|
};
|
|
442
442
|
const changeTouchEnd = (e) => {
|
|
443
443
|
stopNativeScrollEvent(e, TouchType.END);
|
|
444
444
|
mLastClientPosRef.current.mLastClientX = 0;
|
|
445
445
|
mLastClientPosRef.current.mLastClientY = 0;
|
|
446
446
|
};
|
|
447
447
|
const triggerIosTouchMove = () => {
|
|
448
448
|
isJdAndIosDevice && iosDeviceStopNativeScrollEvent(null, TouchType.START, true);
|
|
449
449
|
};
|
|
450
450
|
|
|
451
451
|
const lodashThrottleTriggerIosTouchMove = lodashThrottle(triggerIosTouchMove, 500);
|
|
452
452
|
|
|
453
453
|
const recoverRootEleVerticalScroll = (touchEvent) => {
|
|
454
454
|
const direction = GetSlideDirection(
|
|
455
455
|
mLastClientPosRef.current.mLastClientX,
|
|
456
456
|
mLastClientPosRef.current.mLastClientY,
|
|
457
457
|
touchEvent.clientX,
|
|
458
458
|
touchEvent.clientY,
|
|
459
459
|
);
|
|
460
460
|
if (direction === 1 || direction === 2) {
|
|
461
461
|
rootEleNode &&
|
|
462
462
|
rootEleNode.classList.contains('over-hidden') &&
|
|
463
463
|
rootEleNode.classList.remove('over-hidden');
|
|
464
464
|
}
|
|
465
465
|
};
|
|
466
466
|
const changeTouchMove = (e) => {
|
|
467
467
|
if (isH5AndJdShopView || isH5AndJdShopH5CustomScrollView) {
|
|
468
468
|
const touchEvent = e?.originalEvent?.targetTouches[0] || e?.targetTouches[0];
|
|
469
469
|
const xDiff = Math.abs(touchEvent.clientX - mLastClientPosRef.current.mLastClientX).toFixed(
|
|
470
470
|
2,
|
|
471
471
|
);
|
|
472
472
|
const yDiff = Math.abs(touchEvent.clientY - mLastClientPosRef.current.mLastClientY).toFixed(
|
|
473
473
|
2,
|
|
474
474
|
);
|
|
475
475
|
if (isJdApp) {
|
|
476
476
|
if (xDiff >= window.JDJshopViewInfo.androidTouchSlop) {
|
|
477
477
|
iosNeedDisableVertical && isJdApp && lodashThrottleTriggerIosTouchMove();
|
|
478
478
|
} else if (yDiff > window.JDJshopViewInfo.androidTouchSlop) {
|
|
479
479
|
console.log('纵向滚动触发', yDiff, touchEvent, window.JDJshopViewInfo.androidTouchSlop);
|
|
480
480
|
stopNativeScrollEvent(e, TouchType.END);
|
|
481
481
|
}
|
|
482
482
|
}
|
|
483
483
|
isJdAndH5ScrollState && recoverRootEleVerticalScroll(touchEvent);
|
|
484
484
|
}
|
|
485
485
|
if (!dispatchTouchMove) {
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
488
|
const parentNode = e.target?.parentNode;
|
|
489
489
|
if (!parentNode) {
|
|
490
490
|
return;
|
|
491
491
|
}
|
|
492
492
|
const event = new TouchEvent('touchmove', e);
|
|
493
493
|
parentNode.dispatchEvent(event);
|
|
494
494
|
};
|
|
495
495
|
if (scrollX && isJdApp && !isIgnorePreventNative) {
|
|
496
496
|
return (
|
|
497
497
|
<ScrollView
|
|
498
498
|
scrollX
|
|
499
499
|
onTouchStart={changeTouchStart}
|
|
500
500
|
onTouchEnd={changeTouchEnd}
|
|
501
501
|
onTouchCancel={changeTouchEnd}
|
|
502
502
|
onTouchMove={changeTouchMove}
|
|
503
503
|
enhanced
|
|
504
504
|
showScrollbar={false}
|
|
505
505
|
style={style}
|
|
506
506
|
className={classNames(
|
|
507
507
|
className,
|
|
508
508
|
{
|
|
509
509
|
[customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
|
|
510
510
|
},
|
|
511
511
|
'J_customScroll',
|
|
512
512
|
)}
|
|
513
513
|
{...otherProps}
|
|
514
514
|
>
|
|
515
515
|
{children}
|
|
516
516
|
</ScrollView>
|
|
517
517
|
);
|
|
518
518
|
} else {
|
|
519
519
|
return (
|
|
520
520
|
<ScrollView
|
|
521
521
|
scrollX
|
|
522
522
|
enhanced
|
|
523
523
|
showScrollbar={false}
|
|
524
524
|
{...otherProps}
|
|
525
525
|
className={classNames(
|
|
526
526
|
className,
|
|
527
527
|
{
|
|
528
528
|
[customScrollViewStyle['d-custom-ios-mini-extend-border-radius']]:
|
|
529
529
|
isIosDevice && isWxMin && scrollX && style['borderRadius'],
|
|
530
530
|
},
|
|
531
531
|
{
|
|
532
532
|
[customScrollViewStyle['d-custom-ios-h5-extend-border-radius']]: isIosDevice,
|
|
533
533
|
},
|
|
534
534
|
{
|
|
535
535
|
[customScrollViewStyle['d-custom-mini-hide-scroll']]: isWxMin,
|
|
536
536
|
},
|
|
537
537
|
)}
|
|
538
538
|
style={style}
|
|
539
539
|
>
|
|
540
540
|
{children}
|
|
541
541
|
</ScrollView>
|
|
542
542
|
);
|
|
543
543
|
}
|
|
544
544
|
style: {},
|
|
545
545
|
scrollX: false,
|
|
546
546
|
scrollY: false,
|
|
547
547
|
scrollWithAnimation: true,
|
|
548
548
|
iosNeedDisableVertical: false,
|
|
549
549
|
className: null,
|
|
550
550
|
dispatchTouchMove: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro';
|
|
2
1
|
TaroEventType,
|
|
3
2
|
JUMP_MEMBER_CHANNEL,
|
|
4
3
|
CENTERDISPATCH_JUMPPAGE_VALUE,
|
|
5
4
|
|
|
6
5
|
CARD_BANNER = 'shopMemberCardVenderCardBanner',
|
|
7
6
|
|
|
8
7
|
CARD_NAME = 'shopMemberCardVenderCardName',
|
|
9
8
|
|
|
10
9
|
MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
|
|
11
10
|
|
|
12
11
|
MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
|
|
13
12
|
|
|
14
13
|
MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
|
|
15
14
|
return new Promise((resolve) => {
|
|
16
15
|
requestServer
|
|
17
16
|
.getCustomerCenterDispatch(params)
|
|
18
17
|
.then((response) => {
|
|
19
18
|
if (response.result && response.code === '0') {
|
|
20
19
|
resolve(response.result);
|
|
21
20
|
} else {
|
|
22
21
|
resolve({
|
|
23
22
|
jumpPage:
|
|
24
23
|
response.code === '1'
|
|
25
24
|
? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
26
25
|
: CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
|
|
27
26
|
});
|
|
28
27
|
}
|
|
29
28
|
})
|
|
30
29
|
.catch((err) => {
|
|
31
30
|
resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
|
|
32
31
|
console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
|
|
33
32
|
});
|
|
34
33
|
});
|
|
35
34
|
const currentVenderId = global.info.queryInfo.venderId;
|
|
36
35
|
const currentShopId = global.info.queryInfo.shopId;
|
|
37
36
|
const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
|
|
38
37
|
const forceMemberCardPopup = options?.forceMemberCardPopup;
|
|
39
38
|
const toastOpt = {
|
|
40
39
|
duration: 3000,
|
|
41
40
|
image:
|
|
42
41
|
'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
|
|
43
42
|
};
|
|
44
43
|
if (isAppHomeForMarketPage) {
|
|
45
44
|
JumpEventReport.jdJumpToBottomTabBrandMember({
|
|
46
45
|
shopId: currentShopId,
|
|
47
46
|
venderId: currentVenderId,
|
|
48
47
|
});
|
|
49
48
|
return;
|
|
50
49
|
}
|
|
51
50
|
const params = {
|
|
52
51
|
venderId: currentVenderId,
|
|
53
52
|
channel,
|
|
54
53
|
queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
|
|
55
54
|
};
|
|
56
55
|
const centerDispatchResult = await getCenterDispatchResult(params);
|
|
57
56
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
|
|
58
57
|
const { jumpPage } = centerDispatchResult;
|
|
59
58
|
if (typeof jumpPage !== 'number') {
|
|
60
59
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
|
|
61
60
|
showFailToast({
|
|
62
61
|
title: '网络繁忙,稍后再试吧~',
|
|
63
62
|
...toastOpt,
|
|
64
63
|
});
|
|
65
64
|
return;
|
|
66
65
|
}
|
|
67
66
|
const centerDispatchJumpPageValue = Number(jumpPage);
|
|
68
67
|
if (
|
|
69
68
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
|
|
70
69
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
|
|
71
70
|
) {
|
|
72
71
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
|
|
73
72
|
showFailToast({
|
|
74
73
|
title: '网络繁忙,稍后再试吧~',
|
|
75
74
|
...toastOpt,
|
|
76
75
|
});
|
|
77
76
|
return;
|
|
78
77
|
}
|
|
79
78
|
if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
|
|
80
79
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
|
|
81
80
|
global
|
|
82
81
|
.doLogin()
|
|
83
82
|
.then((res) => {
|
|
84
83
|
console.log('登录成功', res);
|
|
85
84
|
})
|
|
86
85
|
.catch((err) => {
|
|
87
86
|
console.log('登录失败', err);
|
|
88
87
|
});
|
|
89
88
|
return;
|
|
90
89
|
}
|
|
91
90
|
const memberRoleJumpPageValueArr = [
|
|
92
91
|
CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
|
|
93
92
|
CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
|
|
94
93
|
CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
|
|
95
94
|
];
|
|
96
95
|
const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
|
|
97
96
|
if (isMemberRole) {
|
|
98
97
|
showFailToast({
|
|
99
98
|
title: '您已是本店会员,无需再次入会',
|
|
100
99
|
...toastOpt,
|
|
101
100
|
});
|
|
102
101
|
return;
|
|
103
102
|
}
|
|
104
103
|
if (!isH5AndJdShopView && !forceMemberCardPopup) {
|
|
105
104
|
JumpEventReport.jdJumpToNewH5MemberCard();
|
|
106
105
|
return;
|
|
107
106
|
}
|
|
108
107
|
const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
|
|
109
108
|
console.log('一键入会,是否已降级', isDegrade);
|
|
110
109
|
console.log('一键入会,是否低版本', isLowVersion);
|
|
111
110
|
if (isDegrade) {
|
|
112
111
|
console.log('一键入会,已降级');
|
|
113
112
|
showFailToast({
|
|
114
113
|
title: '网络繁忙,稍后再试吧~',
|
|
115
114
|
...toastOpt,
|
|
116
115
|
});
|
|
117
116
|
return;
|
|
118
117
|
}
|
|
119
118
|
if (isLowVersion && !forceMemberCardPopup) {
|
|
120
119
|
console.log('一键入会,低版本');
|
|
121
120
|
JumpEventReport.jdJumpToMemberTab();
|
|
122
121
|
return;
|
|
123
122
|
}
|
|
124
123
|
return new Promise((resolve) => {
|
|
125
124
|
const getOpenCardUrlParams = {
|
|
126
125
|
venderId: currentVenderId,
|
|
127
126
|
shopId: currentShopId,
|
|
128
127
|
channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
|
|
129
128
|
device: global.info.sysInfo?.isJdTabletDevice ? 'tablet' : 'all',
|
|
130
129
|
memberSceneType: 'view',
|
|
131
130
|
...options,
|
|
132
131
|
};
|
|
133
132
|
const memberCardurl =
|
|
134
133
|
window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
|
|
135
134
|
? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
|
|
136
135
|
: `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
|
|
137
136
|
const sourceUrl = encodeURIComponent(window.location.href || '');
|
|
138
137
|
let url =
|
|
139
138
|
sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
|
|
140
139
|
if (!url.includes('http')) {
|
|
141
140
|
url = 'https:' + url;
|
|
142
141
|
}
|
|
143
142
|
console.log('openPopWebview url', url);
|
|
144
143
|
nativeOpenPopWebView({
|
|
145
144
|
url,
|
|
146
145
|
});
|
|
147
146
|
Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
|
|
148
147
|
Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
|
|
149
148
|
console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
|
|
150
149
|
const { shopId, venderId } = res;
|
|
151
150
|
if (shopId === currentShopId && venderId === currentVenderId) {
|
|
152
151
|
resolve(true);
|
|
153
152
|
} else {
|
|
154
153
|
console.log(
|
|
155
154
|
'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
|
|
156
155
|
currentShopId,
|
|
157
156
|
currentVenderId,
|
|
158
157
|
);
|
|
159
158
|
resolve(false);
|
|
160
159
|
}
|
|
161
160
|
});
|
|
162
161
|
});
|
|
162
|
+
import Taro from '@tarojs/taro';
|
|
163
163
|
TaroEventType,
|
|
164
164
|
JUMP_MEMBER_CHANNEL,
|
|
165
165
|
CENTERDISPATCH_JUMPPAGE_VALUE,
|
|
166
166
|
|
|
167
167
|
CARD_BANNER = 'shopMemberCardVenderCardBanner',
|
|
168
168
|
|
|
169
169
|
CARD_NAME = 'shopMemberCardVenderCardName',
|
|
170
170
|
|
|
171
171
|
MEMBERSHIP_LEVEL = 'shopMemberCardMembershipLevel',
|
|
172
172
|
|
|
173
173
|
MEMBERSHIP_RULE_ENTRANCE = 'shopMemberCardMembershipRuleEntrance',
|
|
174
174
|
|
|
175
175
|
MEMBERSHIP_POINT = 'shopMemberCardMembershipPoint',
|
|
176
176
|
return new Promise((resolve) => {
|
|
177
177
|
requestServer
|
|
178
178
|
.getCustomerCenterDispatch(params)
|
|
179
179
|
.then((response) => {
|
|
180
180
|
if (response.result && response.code === '0') {
|
|
181
181
|
resolve(response.result);
|
|
182
182
|
} else {
|
|
183
183
|
resolve({
|
|
184
184
|
jumpPage:
|
|
185
185
|
response.code === '1'
|
|
186
186
|
? CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN
|
|
187
187
|
: CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR,
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
190
|
})
|
|
191
191
|
.catch((err) => {
|
|
192
192
|
resolve({ jumpPage: CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR });
|
|
193
193
|
console.log('oneKeyJoinMember getcustomerCenterDispatch err', err);
|
|
194
194
|
});
|
|
195
195
|
});
|
|
196
196
|
console.log('一键入会', options);
|
|
197
197
|
const currentVenderId = global.info.queryInfo.venderId;
|
|
198
198
|
const currentShopId = global.info.queryInfo.shopId;
|
|
199
199
|
const channel = JUMP_MEMBER_CHANNEL.POP_WEBVIEW;
|
|
200
200
|
const forceMemberCardPopup = options?.forceMemberCardPopup;
|
|
201
201
|
const toastOpt = {
|
|
202
202
|
duration: 3000,
|
|
203
203
|
image:
|
|
204
204
|
'https://img13.360buyimg.com/img/jfs/t1/196933/39/19850/1479/61b059aaEe969b8db/acb37a47b9034333.png',
|
|
205
205
|
};
|
|
206
206
|
if (isAppHomeForMarketPage) {
|
|
207
207
|
JumpEventReport.jdJumpToBottomTabBrandMember({
|
|
208
208
|
shopId: currentShopId,
|
|
209
209
|
venderId: currentVenderId,
|
|
210
210
|
});
|
|
211
211
|
return;
|
|
212
212
|
}
|
|
213
213
|
const params = {
|
|
214
214
|
venderId: currentVenderId,
|
|
215
215
|
channel,
|
|
216
216
|
queryVersion: isH5AndJdShopView && jdAppVersionStr !== '' ? jdAppVersionStr : '9.2.0',
|
|
217
217
|
};
|
|
218
218
|
const centerDispatchResult = await getCenterDispatchResult(params);
|
|
219
219
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回值', centerDispatchResult);
|
|
220
220
|
const { jumpPage } = centerDispatchResult;
|
|
221
221
|
if (typeof jumpPage !== 'number') {
|
|
222
222
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回 jumpPage 值类型异常,非数字');
|
|
223
223
|
showFailToast({
|
|
224
224
|
title: '网络繁忙,稍后再试吧~',
|
|
225
225
|
...toastOpt,
|
|
226
226
|
});
|
|
227
227
|
return;
|
|
228
228
|
}
|
|
229
229
|
const centerDispatchJumpPageValue = Number(jumpPage);
|
|
230
230
|
if (
|
|
231
231
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NETWORK_ERROR ||
|
|
232
232
|
centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.SYSTEM_ERROR
|
|
233
233
|
) {
|
|
234
234
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口网络异常或接口异常', jumpPage);
|
|
235
235
|
showFailToast({
|
|
236
236
|
title: '网络繁忙,稍后再试吧~',
|
|
237
237
|
...toastOpt,
|
|
238
238
|
});
|
|
239
239
|
return;
|
|
240
240
|
}
|
|
241
241
|
if (centerDispatchJumpPageValue === CENTERDISPATCH_JUMPPAGE_VALUE.NOT_LOGGED_IN) {
|
|
242
242
|
console.log('oneKeyJoinMember getcustomerCenterDispatch 接口返回未登录,跳登录页');
|
|
243
243
|
global
|
|
244
244
|
.doLogin()
|
|
245
245
|
.then((res) => {
|
|
246
246
|
console.log('登录成功', res);
|
|
247
247
|
})
|
|
248
248
|
.catch((err) => {
|
|
249
249
|
console.log('登录失败', err);
|
|
250
250
|
});
|
|
251
251
|
return;
|
|
252
252
|
}
|
|
253
253
|
const memberRoleJumpPageValueArr = [
|
|
254
254
|
CENTERDISPATCH_JUMPPAGE_VALUE.MEMBER_CENTER,
|
|
255
255
|
CENTERDISPATCH_JUMPPAGE_VALUE.ISV_MEMBER,
|
|
256
256
|
CENTERDISPATCH_JUMPPAGE_VALUE.JSHOP_ISV_PAGE,
|
|
257
257
|
];
|
|
258
258
|
const isMemberRole = memberRoleJumpPageValueArr.includes(centerDispatchJumpPageValue);
|
|
259
259
|
if (isMemberRole) {
|
|
260
260
|
showFailToast({
|
|
261
261
|
title: '您已是本店会员,无需再次入会',
|
|
262
262
|
...toastOpt,
|
|
263
263
|
});
|
|
264
264
|
return;
|
|
265
265
|
}
|
|
266
266
|
if (!isH5AndJdShopView && !forceMemberCardPopup) {
|
|
267
267
|
JumpEventReport.jdJumpToNewH5MemberCard();
|
|
268
268
|
return;
|
|
269
269
|
}
|
|
270
270
|
const { isDegrade = true, isLowVersion = true } = centerDispatchResult;
|
|
271
271
|
console.log('一键入会,是否已降级', isDegrade);
|
|
272
272
|
console.log('一键入会,是否低版本', isLowVersion);
|
|
273
273
|
if (isDegrade) {
|
|
274
274
|
console.log('一键入会,已降级');
|
|
275
275
|
showFailToast({
|
|
276
276
|
title: '网络繁忙,稍后再试吧~',
|
|
277
277
|
...toastOpt,
|
|
278
278
|
});
|
|
279
279
|
return;
|
|
280
280
|
}
|
|
281
281
|
if (isLowVersion && !forceMemberCardPopup) {
|
|
282
282
|
console.log('一键入会,低版本');
|
|
283
283
|
JumpEventReport.jdJumpToMemberTab();
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
return new Promise((resolve) => {
|
|
287
287
|
const getOpenCardUrlParams = {
|
|
288
288
|
venderId: currentVenderId,
|
|
289
289
|
shopId: currentShopId,
|
|
290
290
|
channel: JUMP_MEMBER_CHANNEL.POP_WEBVIEW,
|
|
291
291
|
device: global.info.sysInfo?.isJdTabletDevice ? 'tablet' : 'all',
|
|
292
292
|
memberSceneType: 'view',
|
|
293
293
|
...options,
|
|
294
294
|
};
|
|
295
295
|
const memberCardurl =
|
|
296
296
|
window?.shopGlobalSwitch?.openNewMemberEntry === 'true'
|
|
297
297
|
? `${JumpWebUrl.memberCard}?${objectToUrlEncode(getOpenCardUrlParams)}`
|
|
298
298
|
: `${JumpWebUrl.shopH5MemberCardAPP}?${objectToUrlEncode(getOpenCardUrlParams)}`;
|
|
299
299
|
const sourceUrl = encodeURIComponent(window.location.href || '');
|
|
300
300
|
let url =
|
|
301
301
|
sourceUrl && sourceUrl !== '' ? `${memberCardurl}&sourceUrl=${sourceUrl}` : memberCardurl;
|
|
302
302
|
if (!url.includes('http')) {
|
|
303
303
|
url = 'https:' + url;
|
|
304
304
|
}
|
|
305
305
|
console.log('openPopWebview url', url);
|
|
306
306
|
nativeOpenPopWebView({
|
|
307
307
|
url,
|
|
308
308
|
});
|
|
309
309
|
Taro.eventCenter.off(TaroEventType.JOIN_MEMBER_SUCCESS);
|
|
310
310
|
Taro.eventCenter.on(TaroEventType.JOIN_MEMBER_SUCCESS, (res) => {
|
|
311
311
|
console.log('TaroEventType.JOIN_MEMBER_SUCCESS res', res);
|
|
312
312
|
const { shopId, venderId } = res;
|
|
313
313
|
if (shopId === currentShopId && venderId === currentVenderId) {
|
|
314
314
|
resolve(true);
|
|
315
315
|
} else {
|
|
316
316
|
console.log(
|
|
317
317
|
'TaroEventType.JOIN_MEMBER_SUCCESS shopId venderId 不匹配,currentShopId, currentVenderId',
|
|
318
318
|
currentShopId,
|
|
319
319
|
currentVenderId,
|
|
320
320
|
);
|
|
321
321
|
resolve(false);
|
|
322
322
|
}
|
|
323
323
|
});
|
|
324
324
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conecli/cone-render",
|
|
3
|
-
"version": "0.10.1-shop-beta.
|
|
3
|
+
"version": "0.10.1-shop-beta.47",
|
|
4
4
|
"private": false,
|
|
5
5
|
"files": [
|
|
6
6
|
"dist/"
|
|
@@ -46,8 +46,9 @@
|
|
|
46
46
|
"dev:qq": "npm run build:qq -- --watch",
|
|
47
47
|
"dev:jd": "npm run build:jd -- --watch",
|
|
48
48
|
"dev:harmony-hybrid": "npm run build:harmony-hybrid -- --watch",
|
|
49
|
-
"compressWatch": "gulp compressWatch --gulpfile ./publish/gulpfile.js",
|
|
49
|
+
"compressWatch": "gulp compressWatch --gulpfile ./publish/gulpfile.js --replaceType=compressWatch",
|
|
50
50
|
"compress": "gulp compress --gulpfile ./publish/gulpfile.js",
|
|
51
|
+
"compressToXingyunDev": "gulp compress --gulpfile ./publish/gulpfile.js --replaceType=xingyunDev",
|
|
51
52
|
"build": "npm run compress",
|
|
52
53
|
"check": "gulp check --gulpfile ./publish/gulpfile.js",
|
|
53
54
|
"build:openShopBridge": "node publish/build-openShopBridge.js"
|
|
@@ -89,60 +90,52 @@
|
|
|
89
90
|
"@babel/runtime": "7.24.4",
|
|
90
91
|
"@tarojs/components": "4.1.2",
|
|
91
92
|
"@tarojs/helper": "4.1.2",
|
|
92
|
-
"@tarojs/plugin-
|
|
93
|
+
"@tarojs/plugin-framework-react": "4.1.2",
|
|
93
94
|
"@tarojs/plugin-platform-alipay": "4.1.2",
|
|
94
|
-
"@tarojs/plugin-platform-tt": "4.1.2",
|
|
95
|
-
"@tarojs/plugin-platform-swan": "4.1.2",
|
|
96
|
-
"@tarojs/plugin-platform-jd": "4.1.2",
|
|
97
|
-
"@tarojs/plugin-platform-qq": "4.1.2",
|
|
98
95
|
"@tarojs/plugin-platform-h5": "4.1.2",
|
|
99
96
|
"@tarojs/plugin-platform-harmony-hybrid": "4.1.2",
|
|
97
|
+
"@tarojs/plugin-platform-jd": "4.1.2",
|
|
98
|
+
"@tarojs/plugin-platform-qq": "4.1.2",
|
|
99
|
+
"@tarojs/plugin-platform-swan": "4.1.2",
|
|
100
|
+
"@tarojs/plugin-platform-tt": "4.1.2",
|
|
101
|
+
"@tarojs/plugin-platform-weapp": "4.1.2",
|
|
102
|
+
"@tarojs/react": "4.1.2",
|
|
100
103
|
"@tarojs/runtime": "4.1.2",
|
|
104
|
+
"@tarojs/service": "4.1.2",
|
|
101
105
|
"@tarojs/shared": "4.1.2",
|
|
102
106
|
"@tarojs/taro": "4.1.2",
|
|
103
|
-
"@tarojs/plugin-framework-react": "4.1.2",
|
|
104
|
-
"@tarojs/react": "4.1.2",
|
|
105
|
-
"@tarojs/service": "4.1.2",
|
|
106
|
-
"react-dom": "^18.2.0",
|
|
107
|
-
"react": "^18.2.0",
|
|
108
107
|
"art-template": "^4.13.2",
|
|
109
108
|
"gulp-filter": "^7.0.0",
|
|
110
109
|
"normalize.css": "^8.0.1",
|
|
110
|
+
"react": "^18.2.0",
|
|
111
111
|
"react-content-loader": "^6.2.0",
|
|
112
|
+
"react-dom": "^18.2.0",
|
|
112
113
|
"react-intersection-observer": "8.33.1",
|
|
113
114
|
"react-refresh": "^0.14.0",
|
|
114
115
|
"sha256": "^0.2.0"
|
|
115
116
|
},
|
|
116
117
|
"devDependencies": {
|
|
117
|
-
"@babel/plugin-transform-strict-mode": "^7.16.7",
|
|
118
118
|
"@babel/core": "7.24.4",
|
|
119
|
-
"@tarojs/cli": "4.1.2",
|
|
120
119
|
"@babel/plugin-proposal-class-properties": "7.14.5",
|
|
121
|
-
"@
|
|
122
|
-
"@
|
|
123
|
-
"webpack": "5.
|
|
120
|
+
"@babel/plugin-transform-strict-mode": "^7.16.7",
|
|
121
|
+
"@babel/preset-react": "^7.24.1",
|
|
122
|
+
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
123
|
+
"@tarojs/cli": "4.1.2",
|
|
124
124
|
"@tarojs/taro-loader": "4.1.2",
|
|
125
125
|
"@tarojs/webpack5-runner": "4.1.2",
|
|
126
|
-
"
|
|
126
|
+
"@types/node": "^18",
|
|
127
|
+
"@types/react": "^18.0.17",
|
|
128
|
+
"@types/webpack-env": "^1.13.6",
|
|
129
|
+
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
130
|
+
"@typescript-eslint/parser": "^6.2.0",
|
|
127
131
|
"babel-preset-taro": "4.1.2",
|
|
128
|
-
"
|
|
132
|
+
"del": "^6.1.1",
|
|
133
|
+
"escodegen": "^2.0.0",
|
|
129
134
|
"eslint": "^8.57.0",
|
|
130
|
-
"
|
|
131
|
-
"react-refresh": "^0.14.0",
|
|
132
|
-
"@babel/preset-react": "^7.24.1",
|
|
133
|
-
"eslint-plugin-react": "^7.34.1",
|
|
135
|
+
"eslint-config-taro": "4.1.2",
|
|
134
136
|
"eslint-plugin-import": "^2.12.0",
|
|
137
|
+
"eslint-plugin-react": "^7.34.1",
|
|
135
138
|
"eslint-plugin-react-hooks": "^4.4.0",
|
|
136
|
-
"stylelint": "^16.4.0",
|
|
137
|
-
"@typescript-eslint/parser": "^6.2.0",
|
|
138
|
-
"@typescript-eslint/eslint-plugin": "^6.2.0",
|
|
139
|
-
"typescript": "^5.4.5",
|
|
140
|
-
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
141
|
-
"postcss": "^8.4.38",
|
|
142
|
-
"ts-node": "^10.9.1",
|
|
143
|
-
"@types/node": "^18",
|
|
144
|
-
"del": "^6.1.1",
|
|
145
|
-
"escodegen": "^2.0.0",
|
|
146
139
|
"espree": "^9.3.2",
|
|
147
140
|
"esprima": "^4.0.1",
|
|
148
141
|
"estraverse": "^5.3.0",
|
|
@@ -150,9 +143,18 @@
|
|
|
150
143
|
"gulp-util": "^3.0.8",
|
|
151
144
|
"html-webpack-plugin": "^5.5.0",
|
|
152
145
|
"mini-css-extract-plugin": "^2.6.1",
|
|
146
|
+
"postcss": "^8.4.38",
|
|
147
|
+
"react-refresh": "^0.14.0",
|
|
148
|
+
"sass": "^1.75.0",
|
|
153
149
|
"shelljs": "^0.8.5",
|
|
150
|
+
"stylelint": "^16.4.0",
|
|
154
151
|
"terser": "^5.44.1",
|
|
155
|
-
"terser-webpack-plugin": "^5.3.6"
|
|
152
|
+
"terser-webpack-plugin": "^5.3.6",
|
|
153
|
+
"ts-node": "^10.9.1",
|
|
154
|
+
"tsconfig-paths-webpack-plugin": "^4.1.0",
|
|
155
|
+
"typescript": "^5.4.5",
|
|
156
|
+
"webpack": "5.91.0",
|
|
157
|
+
"yargs-parser": "^21.1.1"
|
|
156
158
|
},
|
|
157
159
|
"resolutions": {
|
|
158
160
|
"@babel/runtime": "7.24.4",
|