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