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