@conecli/cone-render 0.9.1-shop2.11 → 0.9.1-shop2.12
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.
- package/dist/common/const.ts +1 -1
- package/dist/common/index.h5.ts +1 -1
- package/dist/common/index.jd.ts +1 -1
- package/dist/common/index.ts +1 -1
- package/dist/common/index.weapp.ts +1 -1
- package/dist/common/jdplayerSdk.ts +1 -0
- package/dist/common/sgmCustomCode.ts +1 -1
- package/dist/components/base/CustomVideo/index.tsx +1 -1
- package/dist/components/base/ExposureSmart/index.tsx +1 -1
- package/dist/components/base/InOrOutViewObserver/index.tsx +1 -1
- package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
- package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
- package/dist/components/base/MobileCommonHeader/index.module.scss +8 -0
- package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
- package/dist/components/decorate/EmptyFloorModule/index.tsx +1 -1
- package/dist/components/isv/Floor/index.tsx +1 -1
- package/dist/interface/component.ts +1 -1
- package/dist/jumpEventReport/logEventConfig.ts +1 -1
- package/dist/jumpEventReport/web.tjm.ts +1 -1
- package/dist/jumpEventReport/web.wxapp.ts +1 -1
- package/dist/open/api/index.ts +1 -1
- package/dist/sass/app.h5.scss +5 -0
- package/dist/utils/connectNativeJsBridge.ts +1 -1
- package/dist/utils/h5Utils.ts +1 -1
- package/dist/utils/index.h5.ts +1 -1
- package/dist/utils/index.ts +1 -1
- package/dist/utils/index.weapp.ts +1 -1
- package/dist/utils/utils.ts +1 -1
- package/package.json +1 -1
- package/dist/customHooks/useDocumentVisibilitychange.ts +0 -1
package/dist/utils/index.h5.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import Taro from '@tarojs/taro'
|
|
2
1
|
UtilsInterFace
|
|
3
2
|
nativePageShowToast,
|
|
4
3
|
ToastAndroidType,
|
|
5
4
|
ToastIosType,
|
|
6
5
|
getAppChannelType,
|
|
7
6
|
isAndroidDevice,
|
|
8
7
|
isH5AndJdShopView,
|
|
9
8
|
isChartH5,
|
|
10
9
|
isH5AndJdShopViewNativeScroll,
|
|
11
10
|
isIosDevice,
|
|
12
11
|
isJdAndAndroidDevice,
|
|
13
12
|
isJdAndIosDevice,
|
|
14
13
|
isJdApp,
|
|
15
14
|
isWxApp,
|
|
16
15
|
isWxMiniH5View,
|
|
17
16
|
isJdAndHarmonyDevice,
|
|
18
17
|
isH5AndJingGouMini,
|
|
19
18
|
urlCookie,
|
|
20
19
|
sgmCustomReport,
|
|
21
20
|
isMemberPage,
|
|
22
21
|
isH5AndJdShopViewH5Scroll,
|
|
23
22
|
isH5AndJdShopH5CustomScrollView,
|
|
24
23
|
isAppClassifyPage,
|
|
25
24
|
isPc,
|
|
26
25
|
ipLoc_djd,
|
|
27
26
|
jdAppVersionCompare,
|
|
28
27
|
isTjScence,
|
|
29
28
|
isH5AdnJxMini,
|
|
30
29
|
isTjM,
|
|
31
30
|
isTjJxM,
|
|
32
31
|
isTJApp,
|
|
33
32
|
isH5AdnHaoWuJie,
|
|
34
33
|
tjChannel,
|
|
35
34
|
dealNativePixelToCssPixel,
|
|
36
35
|
isAppStowShop,
|
|
37
36
|
isJdAndroidX5Core,
|
|
38
37
|
addHttps,
|
|
39
38
|
clearTaroStorageKey,
|
|
40
39
|
countStringify,
|
|
41
40
|
dateFormat,
|
|
42
41
|
dealAddress,
|
|
43
42
|
dealShopContentData as originDealShopContentData,
|
|
44
43
|
debounce,
|
|
45
44
|
filterUrlQueryData,
|
|
46
45
|
formatTabActiveMenuType,
|
|
47
46
|
getQualityImage,
|
|
48
47
|
getTaroStorageKeyValue,
|
|
49
48
|
getWxAppCookieStr,
|
|
50
49
|
isH5,
|
|
51
50
|
isMin,
|
|
52
51
|
isJdMin,
|
|
53
52
|
isWxMin,
|
|
54
53
|
isWxMinAndWxapp,
|
|
55
54
|
isJdMinAndHarmony,
|
|
56
55
|
lodashThrottle,
|
|
57
56
|
objectToUrlEncode,
|
|
58
57
|
parseQueryUrlString,
|
|
59
58
|
removeTaroStorageKey,
|
|
60
59
|
setLowSmallPicUrl,
|
|
61
60
|
setTaroStorage,
|
|
62
61
|
showFailToast,
|
|
63
62
|
showNormalToast,
|
|
64
63
|
showSuccessToast,
|
|
65
64
|
sliceArrToChunkList,
|
|
66
65
|
throttle,
|
|
67
66
|
isOpenJdAppUrl,
|
|
68
67
|
jdOpenAppParams,
|
|
69
68
|
createJdOpenAppUrl,
|
|
70
69
|
isEmpty,
|
|
71
70
|
getJdAppReportPageSource,
|
|
72
71
|
dealJdOpenAppData,
|
|
73
72
|
const getNum = Number(num)
|
|
74
73
|
let _changeLayoutWidth = layoutWidth
|
|
75
74
|
if (!_changeLayoutWidth) {
|
|
76
75
|
_changeLayoutWidth =
|
|
77
76
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
78
77
|
? _ShopSystemInfo.windowWidth
|
|
79
78
|
: Taro.getSystemInfoSync()?.windowWidth
|
|
80
79
|
}
|
|
81
80
|
return Math.round((getNum / widthSize) * _changeLayoutWidth)
|
|
82
81
|
changeSize,
|
|
83
82
|
designWidth = 750,
|
|
84
83
|
systemInfo,
|
|
85
84
|
const getRootFontSize =
|
|
86
85
|
(40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
|
|
87
86
|
const getRealRootFontSize =
|
|
88
87
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
|
|
89
88
|
return Math.ceil(
|
|
90
89
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
|
|
91
90
|
getRealRootFontSize,
|
|
92
91
|
)
|
|
93
92
|
console.log(
|
|
94
93
|
'获取系统宽度systemInfo?.windowWidth',
|
|
95
94
|
systemInfo?.windowWidth,
|
|
96
95
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
97
96
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
98
97
|
)
|
|
99
98
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
100
99
|
? systemInfo?.windowWidth -
|
|
101
100
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
102
101
|
: systemInfo?.windowWidth ?? 0
|
|
103
102
|
const systemInfo = Taro.getSystemInfoSync()
|
|
104
103
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
105
104
|
systemInfo.windowWidth = params?.pageWidth
|
|
106
105
|
systemInfo.windowHeight = params?.pageHeight
|
|
107
106
|
}
|
|
108
107
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
|
|
109
108
|
console.warn('====获取系统信息=====', systemInfo)
|
|
110
109
|
return systemInfo
|
|
111
110
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
112
111
|
windowWidth: window.innerWidth,
|
|
113
112
|
containerWidth: getContainerWidth(buildType, {
|
|
114
113
|
windowWidth: window.innerWidth,
|
|
115
114
|
}),
|
|
116
115
|
screenWidth: window.innerWidth,
|
|
117
116
|
platform: '',
|
|
118
117
|
model: '',
|
|
119
118
|
system: '',
|
|
120
119
|
}
|
|
121
120
|
if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
|
|
122
121
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
123
122
|
getSystemInfo['containerWidth'] = getContainerWidth(
|
|
124
123
|
buildType,
|
|
125
124
|
getSystemInfo,
|
|
126
125
|
)
|
|
127
126
|
}
|
|
128
127
|
return getSystemInfo
|
|
129
128
|
const params = Object.assign(
|
|
130
129
|
{},
|
|
131
130
|
{
|
|
132
131
|
title: '',
|
|
133
132
|
duration: 1500,
|
|
134
133
|
},
|
|
135
134
|
options,
|
|
136
135
|
)
|
|
137
136
|
params.duration = params.duration / 1000
|
|
138
137
|
if (isJdApp) {
|
|
139
138
|
const showSuccessType = isIosDevice
|
|
140
139
|
? ToastIosType.SUCCESS
|
|
141
140
|
: ToastAndroidType.SUCCESS
|
|
142
141
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
143
142
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
144
143
|
console.log('执行原生toast success')
|
|
145
144
|
} else {
|
|
146
145
|
showSuccessToast(options)
|
|
147
146
|
}
|
|
148
147
|
const params = Object.assign(
|
|
149
148
|
{},
|
|
150
149
|
{
|
|
151
150
|
title: '',
|
|
152
151
|
duration: 1500,
|
|
153
152
|
},
|
|
154
153
|
options,
|
|
155
154
|
)
|
|
156
155
|
params.duration = params.duration / 1000
|
|
157
156
|
if (isJdApp) {
|
|
158
157
|
const showSuccessType = isIosDevice
|
|
159
158
|
? ToastIosType.FAIL
|
|
160
159
|
: ToastAndroidType.FAIL
|
|
161
160
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
162
161
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
163
162
|
console.log('执行原生toast fail')
|
|
164
163
|
} else {
|
|
165
164
|
console.log('执行H5 toast fail')
|
|
166
165
|
showFailToast(options)
|
|
167
166
|
}
|
|
168
167
|
const params = Object.assign(
|
|
169
168
|
{},
|
|
170
169
|
{
|
|
171
170
|
title: '',
|
|
172
171
|
duration: 1500,
|
|
173
172
|
},
|
|
174
173
|
options,
|
|
175
174
|
)
|
|
176
175
|
params.duration = params.duration / 1000
|
|
177
176
|
if (isJdApp) {
|
|
178
177
|
const showSuccessType = isIosDevice ?
|
|
179
178
|
ToastIosType.NORMAL :
|
|
180
179
|
ToastAndroidType.NORMAL
|
|
181
180
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
182
181
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
183
182
|
} else {
|
|
184
183
|
showNormalToast(options)
|
|
185
184
|
}
|
|
186
185
|
const createLoadingEle = document.createElement('div')
|
|
187
186
|
createLoadingEle.id = 'J_shopLoading'
|
|
188
187
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
189
188
|
createLoadingEle.innerHTML =
|
|
190
189
|
`<div class='d-loading-content'>
|
|
191
190
|
<span class='d-shop-loading-icon'></span>
|
|
192
191
|
<p class='d-shop-text'>${text}</p>
|
|
193
192
|
</div>`
|
|
194
193
|
const getEle = document.body
|
|
195
194
|
? document.body
|
|
196
195
|
: document.getElementsByTagName('body')[0]
|
|
197
196
|
getEle.appendChild(createLoadingEle)
|
|
198
197
|
const getEle = document.getElementById('J_shopLoading')
|
|
199
198
|
getEle && getEle.remove()
|
|
200
199
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
|
|
201
200
|
params,
|
|
202
201
|
)
|
|
203
202
|
if (!systemInfo.system && window) {
|
|
204
203
|
systemInfo.system = window.navigator.userAgent
|
|
205
204
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
206
205
|
}
|
|
207
206
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
208
207
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
209
208
|
systemInfo.navBarHeight = 0
|
|
210
209
|
systemInfo.statusBarHeight = 0
|
|
211
210
|
systemInfo.capsulePosition = null
|
|
212
211
|
systemInfo.isIOS = isIOS
|
|
213
212
|
systemInfo.isAndroid = isAndroid
|
|
214
213
|
_ShopSystemInfo = systemInfo
|
|
215
214
|
return systemInfo
|
|
216
215
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
217
216
|
isJdApp,
|
|
218
217
|
isWxApp,
|
|
219
218
|
isIosDevice,
|
|
220
219
|
isAndroidDevice,
|
|
221
220
|
isJdAndIosDevice,
|
|
222
221
|
isJdAndAndroidDevice,
|
|
223
222
|
isJdAndHarmonyDevice,
|
|
224
223
|
isJdAndroidX5Core,
|
|
225
224
|
isMin,
|
|
226
225
|
isWxMin,
|
|
227
226
|
isWxMinAndWxapp,
|
|
228
227
|
isJdMinAndHarmony,
|
|
229
228
|
isJdMin,
|
|
230
229
|
isH5,
|
|
231
230
|
isH5AndJdShopView,
|
|
232
231
|
isChartH5,
|
|
233
232
|
isH5AndJdShopViewNativeScroll,
|
|
234
233
|
isH5AndJdShopViewH5Scroll,
|
|
235
234
|
isH5AndJdShopH5CustomScrollView,
|
|
236
235
|
isH5AndJingGouMini,
|
|
237
236
|
isWxMiniH5View,
|
|
238
237
|
urlCookie,
|
|
239
238
|
sliceArrToChunkList,
|
|
240
239
|
dealAddress,
|
|
241
240
|
objectToUrlEncode,
|
|
242
241
|
parseQueryUrlString,
|
|
243
242
|
setLowSmallPicUrl,
|
|
244
243
|
setTaroStorage,
|
|
245
244
|
getTaroStorageKeyValue,
|
|
246
245
|
removeTaroStorageKey,
|
|
247
246
|
clearTaroStorageKey,
|
|
248
247
|
getQualityImage,
|
|
249
248
|
countStringify,
|
|
250
249
|
getWxAppCookieStr,
|
|
251
250
|
getSystemInfos,
|
|
252
251
|
pxTransformFromData,
|
|
253
252
|
dealShopContentDataAndReport as dealShopContentData,
|
|
254
253
|
dateFormat,
|
|
255
254
|
throttle,
|
|
256
255
|
lodashThrottle,
|
|
257
256
|
debounce,
|
|
258
257
|
addHttps,
|
|
259
258
|
commonShowSuccessToast as showSuccessToast,
|
|
260
259
|
commonShowFailToast as showFailToast,
|
|
261
260
|
commonShowNormalToast as showNormalToast,
|
|
262
261
|
showShopLoading,
|
|
263
262
|
hideShopLoading,
|
|
264
263
|
getAppChannelType,
|
|
265
264
|
formatTabActiveMenuType,
|
|
266
265
|
filterUrlQueryData,
|
|
267
266
|
sgmCustomReport,
|
|
268
267
|
isMemberPage,
|
|
269
268
|
getFloorDataToDataDefines,
|
|
270
269
|
isOpenJdAppUrl,
|
|
271
270
|
jdOpenAppParams,
|
|
272
271
|
createJdOpenAppUrl,
|
|
273
272
|
isEmpty,
|
|
274
273
|
getJdAppReportPageSource,
|
|
275
274
|
isAppClassifyPage,
|
|
276
275
|
isPc,
|
|
277
276
|
ipLoc_djd,
|
|
278
277
|
isTjScence,
|
|
279
278
|
isH5AdnJxMini,
|
|
280
279
|
isTjM,
|
|
281
280
|
isTjJxM,
|
|
282
281
|
isTJApp,
|
|
283
282
|
isH5AdnHaoWuJie,
|
|
284
283
|
tjChannel,
|
|
285
284
|
dealJdOpenAppData,
|
|
286
285
|
jdAppVersionCompare,
|
|
287
286
|
dealNativePixelToCssPixel,
|
|
288
287
|
isAppStowShop,
|
|
289
288
|
getSgmCustomCode
|
|
289
|
+
import Taro from '@tarojs/taro'
|
|
290
290
|
UtilsInterFace
|
|
291
291
|
nativePageShowToast,
|
|
292
292
|
ToastAndroidType,
|
|
293
293
|
ToastIosType,
|
|
294
294
|
getAppChannelType,
|
|
295
295
|
isAndroidDevice,
|
|
296
296
|
isH5AndJdShopView,
|
|
297
297
|
isChartH5,
|
|
298
298
|
isH5AndJdShopViewNativeScroll,
|
|
299
299
|
isIosDevice,
|
|
300
300
|
isJdAndAndroidDevice,
|
|
301
301
|
isJdAndIosDevice,
|
|
302
302
|
isJdApp,
|
|
303
303
|
isWxApp,
|
|
304
304
|
isWxMiniH5View,
|
|
305
305
|
isJdAndHarmonyDevice,
|
|
306
306
|
isH5AndJingGouMini,
|
|
307
307
|
urlCookie,
|
|
308
308
|
sgmCustomReport,
|
|
309
309
|
isMemberPage,
|
|
310
310
|
isH5AndJdShopViewH5Scroll,
|
|
311
311
|
isH5AndJdShopH5CustomScrollView,
|
|
312
312
|
isAppClassifyPage,
|
|
313
313
|
isPc,
|
|
314
314
|
ipLoc_djd,
|
|
315
315
|
jdAppVersionCompare,
|
|
316
316
|
isTjScence,
|
|
317
317
|
isH5AdnJxMini,
|
|
318
318
|
isTjM,
|
|
319
319
|
isTjJxM,
|
|
320
320
|
isTJApp,
|
|
321
321
|
isH5AdnHaoWuJie,
|
|
322
322
|
tjChannel,
|
|
323
323
|
dealNativePixelToCssPixel,
|
|
324
324
|
isAppStowShop,
|
|
325
325
|
isJdAndroidX5Core,
|
|
326
326
|
parseQueryUrlObj,
|
|
327
327
|
addHttps,
|
|
328
328
|
clearTaroStorageKey,
|
|
329
329
|
countStringify,
|
|
330
330
|
dateFormat,
|
|
331
331
|
dealAddress,
|
|
332
332
|
dealShopContentData as originDealShopContentData,
|
|
333
333
|
debounce,
|
|
334
334
|
filterUrlQueryData,
|
|
335
335
|
formatTabActiveMenuType,
|
|
336
336
|
getAvifSupport,
|
|
337
337
|
getWebpSupport,
|
|
338
338
|
getTaroStorageKeyValue,
|
|
339
339
|
getWxAppCookieStr,
|
|
340
340
|
isH5,
|
|
341
341
|
isMin,
|
|
342
342
|
isJdMin,
|
|
343
343
|
isWxMin,
|
|
344
344
|
isWxMinAndWxapp,
|
|
345
345
|
isJdMinAndHarmony,
|
|
346
346
|
lodashThrottle,
|
|
347
347
|
objectToUrlEncode,
|
|
348
348
|
parseQueryUrlString,
|
|
349
349
|
removeTaroStorageKey,
|
|
350
350
|
setLowSmallPicUrl,
|
|
351
351
|
setTaroStorage,
|
|
352
352
|
showFailToast,
|
|
353
353
|
showNormalToast,
|
|
354
354
|
showSuccessToast,
|
|
355
355
|
sliceArrToChunkList,
|
|
356
356
|
throttle,
|
|
357
357
|
getQualityImageNew,
|
|
358
358
|
getQualityImageOld,
|
|
359
359
|
isOpenJdAppUrl,
|
|
360
360
|
jdOpenAppParams,
|
|
361
361
|
createJdOpenAppUrl,
|
|
362
362
|
isEmpty,
|
|
363
363
|
getJdAppReportPageSource,
|
|
364
364
|
dealJdOpenAppData,
|
|
365
365
|
const getNum = Number(num)
|
|
366
366
|
let _changeLayoutWidth = layoutWidth
|
|
367
367
|
if (!_changeLayoutWidth) {
|
|
368
368
|
_changeLayoutWidth =
|
|
369
369
|
_ShopSystemInfo && _ShopSystemInfo?.windowWidth
|
|
370
370
|
? _ShopSystemInfo.windowWidth
|
|
371
371
|
: Taro.getSystemInfoSync()?.windowWidth
|
|
372
372
|
}
|
|
373
373
|
return Math.round((getNum / widthSize) * _changeLayoutWidth)
|
|
374
374
|
changeSize,
|
|
375
375
|
designWidth = 750,
|
|
376
376
|
systemInfo,
|
|
377
377
|
const getRootFontSize =
|
|
378
378
|
(40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
|
|
379
379
|
const getRealRootFontSize =
|
|
380
380
|
getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
|
|
381
381
|
return Math.ceil(
|
|
382
382
|
(((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
|
|
383
383
|
getRealRootFontSize,
|
|
384
384
|
)
|
|
385
385
|
console.log(
|
|
386
386
|
'获取系统宽度systemInfo?.windowWidth',
|
|
387
387
|
systemInfo?.windowWidth,
|
|
388
388
|
'taroToTransformRoutimePXNumber(changeWidth)',
|
|
389
389
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
|
|
390
390
|
)
|
|
391
391
|
return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
|
|
392
392
|
? systemInfo?.windowWidth -
|
|
393
393
|
taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
|
|
394
394
|
: systemInfo?.windowWidth ?? 0
|
|
395
395
|
const systemInfo = Taro.getSystemInfoSync()
|
|
396
396
|
if (params && params?.pageWidth && params?.pageHeight) {
|
|
397
397
|
systemInfo.windowWidth = params?.pageWidth
|
|
398
398
|
systemInfo.windowHeight = params?.pageHeight
|
|
399
399
|
}
|
|
400
400
|
systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
|
|
401
401
|
console.warn('====获取系统信息=====', systemInfo)
|
|
402
402
|
return systemInfo
|
|
403
403
|
const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
|
|
404
404
|
const supportBuildType = /app-view|app-member|app-classify|member-home/
|
|
405
405
|
const scopeCheckPass = supportBuildType.test(buildType || '')
|
|
406
406
|
const enableAvifOptimize = appVersionCheckPass && scopeCheckPass
|
|
407
407
|
if(enableAvifOptimize){
|
|
408
408
|
const configData = global.getDynamicConfig('avifSwitch')
|
|
409
409
|
if(!hasOutputLog){
|
|
410
410
|
console.warn("🚗 ~~ file: utils.ts:187 ~~ isImageOptimizeEnable ~~ enableAvifOptimize:", enableAvifOptimize, ' appVersionCheckPass:', appVersionCheckPass, ' scopeCheckPass:', scopeCheckPass)
|
|
411
411
|
console.warn("🚗 ~~ file: utils.ts:188 ~~ global.getDynamicConfig ~~ configData:", configData)
|
|
412
412
|
}
|
|
413
413
|
const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, whiteList = [], blackList = [] } = configData || {}
|
|
414
414
|
const {shopId = '0', venderId = '0'} = parseQueryUrlObj
|
|
415
415
|
let imageEnableResult = true
|
|
416
416
|
isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
|
|
417
417
|
if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
418
418
|
imageEnableResult = false
|
|
419
419
|
if(!hasOutputLog){
|
|
420
420
|
console.warn("🚗 ~~ file: utils.ts:198 命中黑名单!")
|
|
421
421
|
}
|
|
422
422
|
}else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
|
|
423
423
|
imageEnableResult = true
|
|
424
424
|
if(!hasOutputLog){
|
|
425
425
|
console.warn("🚗 ~~ file: utils.ts:205 命中白名单!")
|
|
426
426
|
}
|
|
427
427
|
}else{
|
|
428
428
|
imageEnableResult = globalOn === true || page[buildType] === true
|
|
429
429
|
if(!hasOutputLog){
|
|
430
430
|
console.warn("🚗 ~~ file: utils.ts:211 走全局开关+页面开关控制逻辑,开关结果:", imageEnableResult)
|
|
431
431
|
}
|
|
432
432
|
}
|
|
433
433
|
if(!hasOutputLog){
|
|
434
434
|
hasOutputLog = true
|
|
435
435
|
}
|
|
436
436
|
return imageEnableResult
|
|
437
437
|
}else{
|
|
438
438
|
return false
|
|
439
439
|
}
|
|
440
440
|
if(typeof options === 'object' && isImageOptimizeEnable()){
|
|
441
441
|
return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
|
|
442
442
|
}else{
|
|
443
443
|
return getQualityImageOld(imgUrl, options)
|
|
444
444
|
}
|
|
445
445
|
const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
|
|
446
446
|
windowWidth: window.innerWidth,
|
|
447
447
|
containerWidth: getContainerWidth(buildType, {
|
|
448
448
|
windowWidth: window.innerWidth,
|
|
449
449
|
}),
|
|
450
450
|
screenWidth: window.innerWidth,
|
|
451
451
|
platform: '',
|
|
452
452
|
model: '',
|
|
453
453
|
system: '',
|
|
454
454
|
}
|
|
455
455
|
if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
|
|
456
456
|
getSystemInfo.windowWidth = getSystemInfo.screenWidth
|
|
457
457
|
getSystemInfo['containerWidth'] = getContainerWidth(
|
|
458
458
|
buildType,
|
|
459
459
|
getSystemInfo,
|
|
460
460
|
)
|
|
461
461
|
}
|
|
462
462
|
return getSystemInfo
|
|
463
463
|
const params = Object.assign(
|
|
464
464
|
{},
|
|
465
465
|
{
|
|
466
466
|
title: '',
|
|
467
467
|
duration: 1500,
|
|
468
468
|
},
|
|
469
469
|
options,
|
|
470
470
|
)
|
|
471
471
|
params.duration = params.duration / 1000
|
|
472
472
|
if (isJdApp) {
|
|
473
473
|
const showSuccessType = isIosDevice
|
|
474
474
|
? ToastIosType.SUCCESS
|
|
475
475
|
: ToastAndroidType.SUCCESS
|
|
476
476
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
477
477
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
478
478
|
console.log('执行原生toast success')
|
|
479
479
|
} else {
|
|
480
480
|
showSuccessToast(options)
|
|
481
481
|
}
|
|
482
482
|
const params = Object.assign(
|
|
483
483
|
{},
|
|
484
484
|
{
|
|
485
485
|
title: '',
|
|
486
486
|
duration: 1500,
|
|
487
487
|
},
|
|
488
488
|
options,
|
|
489
489
|
)
|
|
490
490
|
params.duration = params.duration / 1000
|
|
491
491
|
if (isJdApp) {
|
|
492
492
|
const showSuccessType = isIosDevice
|
|
493
493
|
? ToastIosType.FAIL
|
|
494
494
|
: ToastAndroidType.FAIL
|
|
495
495
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
496
496
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
497
497
|
console.log('执行原生toast fail')
|
|
498
498
|
} else {
|
|
499
499
|
console.log('执行H5 toast fail')
|
|
500
500
|
showFailToast(options)
|
|
501
501
|
}
|
|
502
502
|
const params = Object.assign(
|
|
503
503
|
{},
|
|
504
504
|
{
|
|
505
505
|
title: '',
|
|
506
506
|
duration: 1500,
|
|
507
507
|
},
|
|
508
508
|
options,
|
|
509
509
|
)
|
|
510
510
|
params.duration = params.duration / 1000
|
|
511
511
|
if (isJdApp) {
|
|
512
512
|
const showSuccessType = isIosDevice ?
|
|
513
513
|
ToastIosType.NORMAL :
|
|
514
514
|
ToastAndroidType.NORMAL
|
|
515
515
|
const duration = isAndroidDevice ? 0 : params.duration
|
|
516
516
|
nativePageShowToast(options.title, showSuccessType, duration)
|
|
517
517
|
} else {
|
|
518
518
|
showNormalToast(options)
|
|
519
519
|
}
|
|
520
520
|
const createLoadingEle = document.createElement('div')
|
|
521
521
|
createLoadingEle.id = 'J_shopLoading'
|
|
522
522
|
createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
|
|
523
523
|
createLoadingEle.innerHTML =
|
|
524
524
|
`<div class='d-loading-content'>
|
|
525
525
|
<span class='d-shop-loading-icon'></span>
|
|
526
526
|
<p class='d-shop-text'>${text}</p>
|
|
527
527
|
</div>`
|
|
528
528
|
const getEle = document.body
|
|
529
529
|
? document.body
|
|
530
530
|
: document.getElementsByTagName('body')[0]
|
|
531
531
|
getEle.appendChild(createLoadingEle)
|
|
532
532
|
const getEle = document.getElementById('J_shopLoading')
|
|
533
533
|
getEle && getEle.remove()
|
|
534
534
|
const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
|
|
535
535
|
params,
|
|
536
536
|
)
|
|
537
537
|
if (!systemInfo.system && window) {
|
|
538
538
|
systemInfo.system = window.navigator.userAgent
|
|
539
539
|
systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
|
|
540
540
|
}
|
|
541
541
|
const isIOS = !!systemInfo?.system.match(/ios/i)
|
|
542
542
|
const isAndroid = !!systemInfo?.system.match(/android/i)
|
|
543
543
|
systemInfo.navBarHeight = 0
|
|
544
544
|
systemInfo.statusBarHeight = 0
|
|
545
545
|
systemInfo.capsulePosition = null
|
|
546
546
|
systemInfo.isIOS = isIOS
|
|
547
547
|
systemInfo.isAndroid = isAndroid
|
|
548
548
|
_ShopSystemInfo = systemInfo
|
|
549
549
|
return systemInfo
|
|
550
550
|
return originDealShopContentData(pageData, sgmCustomReport, isvdev)
|
|
551
551
|
isJdApp,
|
|
552
552
|
isWxApp,
|
|
553
553
|
isIosDevice,
|
|
554
554
|
isAndroidDevice,
|
|
555
555
|
isJdAndIosDevice,
|
|
556
556
|
isJdAndAndroidDevice,
|
|
557
557
|
isJdAndHarmonyDevice,
|
|
558
558
|
isJdAndroidX5Core,
|
|
559
559
|
isMin,
|
|
560
560
|
isWxMin,
|
|
561
561
|
isWxMinAndWxapp,
|
|
562
562
|
isJdMinAndHarmony,
|
|
563
563
|
isJdMin,
|
|
564
564
|
isH5,
|
|
565
565
|
isH5AndJdShopView,
|
|
566
566
|
isChartH5,
|
|
567
567
|
isH5AndJdShopViewNativeScroll,
|
|
568
568
|
isH5AndJdShopViewH5Scroll,
|
|
569
569
|
isH5AndJdShopH5CustomScrollView,
|
|
570
570
|
isH5AndJingGouMini,
|
|
571
571
|
isWxMiniH5View,
|
|
572
572
|
urlCookie,
|
|
573
573
|
sliceArrToChunkList,
|
|
574
574
|
dealAddress,
|
|
575
575
|
objectToUrlEncode,
|
|
576
576
|
parseQueryUrlString,
|
|
577
577
|
setLowSmallPicUrl,
|
|
578
578
|
setTaroStorage,
|
|
579
579
|
getTaroStorageKeyValue,
|
|
580
580
|
removeTaroStorageKey,
|
|
581
581
|
clearTaroStorageKey,
|
|
582
582
|
getAvifSupport,
|
|
583
583
|
getWebpSupport,
|
|
584
584
|
getQualityImage,
|
|
585
585
|
countStringify,
|
|
586
586
|
getWxAppCookieStr,
|
|
587
587
|
getSystemInfos,
|
|
588
588
|
pxTransformFromData,
|
|
589
589
|
dealShopContentDataAndReport as dealShopContentData,
|
|
590
590
|
dateFormat,
|
|
591
591
|
throttle,
|
|
592
592
|
lodashThrottle,
|
|
593
593
|
debounce,
|
|
594
594
|
addHttps,
|
|
595
595
|
commonShowSuccessToast as showSuccessToast,
|
|
596
596
|
commonShowFailToast as showFailToast,
|
|
597
597
|
commonShowNormalToast as showNormalToast,
|
|
598
598
|
showShopLoading,
|
|
599
599
|
hideShopLoading,
|
|
600
600
|
getAppChannelType,
|
|
601
601
|
formatTabActiveMenuType,
|
|
602
602
|
filterUrlQueryData,
|
|
603
603
|
sgmCustomReport,
|
|
604
604
|
isMemberPage,
|
|
605
605
|
getFloorDataToDataDefines,
|
|
606
606
|
isOpenJdAppUrl,
|
|
607
607
|
jdOpenAppParams,
|
|
608
608
|
createJdOpenAppUrl,
|
|
609
609
|
isEmpty,
|
|
610
610
|
getJdAppReportPageSource,
|
|
611
611
|
isAppClassifyPage,
|
|
612
612
|
isImageOptimizeEnable,
|
|
613
613
|
isPc,
|
|
614
614
|
ipLoc_djd,
|
|
615
615
|
isTjScence,
|
|
616
616
|
isH5AdnJxMini,
|
|
617
617
|
isTjM,
|
|
618
618
|
isTjJxM,
|
|
619
619
|
isTJApp,
|
|
620
620
|
isH5AdnHaoWuJie,
|
|
621
621
|
tjChannel,
|
|
622
622
|
dealJdOpenAppData,
|
|
623
623
|
jdAppVersionCompare,
|
|
624
624
|
dealNativePixelToCssPixel,
|
|
625
625
|
isAppStowShop,
|
|
626
626
|
getSgmCustomCode
|