@conecli/cone-render 0.8.20-shop.137 → 0.8.20-shop.139

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 Taro from '@tarojs/taro'
2
1
  nativePageShowToast,
3
2
  ToastAndroidType,
4
3
  ToastIosType,
5
4
  stopNativeScrollEvent,
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
  isJdAndHarmonyDevice,
15
14
  isJdApp,
16
15
  isWxApp,
17
16
  isWxMiniH5View,
18
17
  isH5AndJingGouMini,
19
18
  urlCookie,
20
19
  sgmCustomReport,
21
20
  draCustomReport,
22
21
  remoteCustomReport,
23
22
  isMemberPage,
24
23
  isH5AndJdShopViewH5Scroll,
25
24
  isH5AndJdShopH5CustomScrollView,
26
25
  isAppClassifyPage,
27
26
  isAppHomeForMarketPage,
28
27
  isPc,
29
28
  ipLoc_djd,
30
29
  jdAppVersionCompare,
31
30
  dealNativePixelToCssPixel,
32
31
  isAppStowShop,
33
32
  isJdAndroidX5Core,
34
33
  isTjScence,
35
34
  isH5AdnJxMini,
36
35
  isTjM,
37
36
  isTjJxM,
38
37
  isTJApp,
39
38
  isH5AdnHaoWuJie,
40
39
  tjChannel,
41
40
  parseQueryUrlObj,
42
41
  isIpadDevice,
43
42
  addHttps,
44
43
  clearTaroStorageKey,
45
44
  countStringify,
46
45
  dateFormat,
47
46
  dealAddress,
48
47
  dealShopContentData as originDealShopContentData,
49
48
  debounce,
50
49
  filterUrlQueryData,
51
50
  formatTabActiveMenuType,
52
51
  getAvifSupport,
53
52
  getWebpSupport,
54
53
  getTaroStorageKeyValue,
55
54
  getWxAppCookieStr,
56
55
  isH5,
57
56
  isMin,
58
57
  isJdMin,
59
58
  isWxMin,
60
59
  isWxMinAndWxapp,
61
60
  isJdMinAndHarmony,
62
61
  lodashThrottle,
63
62
  objectToUrlEncode,
64
63
  parseQueryUrlString,
65
64
  removeTaroStorageKey,
66
65
  setLowSmallPicUrl,
67
66
  setTaroStorage,
68
67
  showFailToast,
69
68
  showNormalToast,
70
69
  showSuccessToast,
71
70
  sliceArrToChunkList,
72
71
  throttle,
73
72
  getQualityImageNew,
74
73
  getQualityImageOld,
75
74
  isOpenJdAppUrl,
76
75
  jdOpenAppParams,
77
76
  createJdOpenAppUrl,
78
77
  isEmpty,
79
78
  getJdAppReportPageSource,
80
79
  dealJdOpenAppData,
81
80
  SgmCustomCode,
82
81
  } from '../common/sgmCustomCode'
83
82
  const getNum = Number(num)
84
83
  let _changeLayoutWidth = layoutWidth
85
84
  if (!_changeLayoutWidth) {
86
85
  _changeLayoutWidth =
87
86
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
88
87
  ? _ShopSystemInfo.windowWidth
89
88
  : Taro.getSystemInfoSync()?.windowWidth
90
89
  }
91
90
  return Math.round((getNum / widthSize) * _changeLayoutWidth)
92
91
  changeSize,
93
92
  designWidth = 750,
94
93
  systemInfo,
95
94
  const getRootFontSize =
96
95
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
97
96
  const getRealRootFontSize =
98
97
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
99
98
  return Math.ceil(
100
99
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
101
100
  getRealRootFontSize,
102
101
  )
103
102
  console.log(
104
103
  '获取系统宽度systemInfo?.windowWidth',
105
104
  systemInfo?.windowWidth,
106
105
  'taroToTransformRoutimePXNumber(changeWidth)',
107
106
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
108
107
  )
109
108
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
110
109
  ? systemInfo?.windowWidth -
111
110
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
112
111
  : systemInfo?.windowWidth ?? 0
113
112
  const systemInfo = Taro.getSystemInfoSync()
114
113
  if (params && params?.pageWidth && params?.pageHeight) {
115
114
  systemInfo.windowWidth = params?.pageWidth
116
115
  systemInfo.windowHeight = params?.pageHeight
117
116
  }
118
117
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
119
118
  console.warn('====获取系统信息=====', systemInfo)
120
119
  return systemInfo
121
120
  let result: boolean | null = null
122
121
  return function() {
123
122
  if (result === null) {
124
123
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
125
124
  if(!isJdApp){
126
125
  console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
127
126
  isIgnoreOptimizeFromServer = true
128
127
  result = true
129
128
  return true
130
129
  }
131
130
  const enableAvifOptimize = appVersionCheckPass
132
131
  if(enableAvifOptimize){
133
132
  const configData = global.getDynamicConfig('avifSwitch')
134
133
  console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
135
134
  console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
136
135
  const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
137
136
  const {shopId = '0', venderId = '0'} = parseQueryUrlObj
138
137
  let imageEnableResult = true
139
138
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
140
139
  console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
141
140
  if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
142
141
  imageEnableResult = false
143
142
  console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
144
143
  }else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
145
144
  isIgnoreOptimizeFromServer = true
146
145
  imageEnableResult = true
147
146
  console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
148
147
  }else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
149
148
  isIgnoreOptimizeFromServer = true
150
149
  imageEnableResult = true
151
150
  console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
152
151
  }else{
153
152
  imageEnableResult = globalOn === true || page[buildType] === true
154
153
  if(globalOn === true){
155
154
  isIgnoreOptimizeFromServer = true
156
155
  console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
157
156
  }else if(page[buildType] === true){
158
157
  console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
159
158
  }else{
160
159
  console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
161
160
  }
162
161
  }
163
162
  result = imageEnableResult
164
163
  return imageEnableResult
165
164
  }else{
166
165
  result = false
167
166
  return false
168
167
  }
169
168
  } else {
170
169
  return result
171
170
  }
172
171
  }
173
172
  if(typeof options === 'object' && isImageOptimizeEnable()){
174
173
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
175
174
  }else{
176
175
  return getQualityImageOld(imgUrl, options)
177
176
  }
178
177
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
179
178
  windowWidth: window.innerWidth,
180
179
  containerWidth: getContainerWidth(buildType, {
181
180
  windowWidth: window.innerWidth,
182
181
  }),
183
182
  screenWidth: window.innerWidth,
184
183
  platform: '',
185
184
  model: '',
186
185
  system: '',
187
186
  }
188
187
  if (isJdApp && isAndroidDevice && getSystemInfo.windowWidth <= 0) {
189
188
  getSystemInfo.windowWidth = getSystemInfo.screenWidth
190
189
  getSystemInfo['containerWidth'] = getContainerWidth(
191
190
  buildType,
192
191
  getSystemInfo,
193
192
  )
194
193
  }
195
194
  return getSystemInfo
196
195
  const params = Object.assign(
197
196
  {},
198
197
  {
199
198
  title: '',
200
199
  duration: 1500,
201
200
  },
202
201
  options,
203
202
  )
204
203
  params.duration = params.duration / 1000
205
204
  if (isJdApp) {
206
205
  const showSuccessType = isIosDevice
207
206
  ? ToastIosType.SUCCESS
208
207
  : ToastAndroidType.SUCCESS
209
208
  const duration = isAndroidDevice ? 0 : params.duration
210
209
  nativePageShowToast(options.title, showSuccessType, duration)
211
210
  console.log('执行原生toast success')
212
211
  } else {
213
212
  showSuccessToast(options)
214
213
  }
215
214
  const params = Object.assign(
216
215
  {},
217
216
  {
218
217
  title: '',
219
218
  duration: 1500,
220
219
  },
221
220
  options,
222
221
  )
223
222
  params.duration = params.duration / 1000
224
223
  if (isJdApp) {
225
224
  const showSuccessType = isIosDevice
226
225
  ? ToastIosType.FAIL
227
226
  : ToastAndroidType.FAIL
228
227
  const duration = isAndroidDevice ? 0 : params.duration
229
228
  nativePageShowToast(options.title, showSuccessType, duration)
230
229
  console.log('执行原生toast fail')
231
230
  } else {
232
231
  console.log('执行H5 toast fail')
233
232
  showFailToast(options)
234
233
  }
235
234
  const params = Object.assign(
236
235
  {},
237
236
  {
238
237
  title: '',
239
238
  duration: 1500,
240
239
  },
241
240
  options,
242
241
  )
243
242
  params.duration = params.duration / 1000
244
243
  if (isJdApp) {
245
244
  const showSuccessType = isIosDevice
246
245
  ? ToastIosType.NORMAL
247
246
  : ToastAndroidType.NORMAL
248
247
  const duration = isAndroidDevice ? 0 : params.duration
249
248
  nativePageShowToast(options.title, showSuccessType, duration)
250
249
  } else {
251
250
  showNormalToast(options)
252
251
  }
253
252
  const createLoadingEle = document.createElement('div')
254
253
  createLoadingEle.id = 'J_shopLoading'
255
254
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
256
255
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
257
256
  <span class='d-shop-loading-icon'></span>
258
257
  <p class='d-shop-text'>${text}</p>
259
258
  </div>`
260
259
  const getEle = document.body
261
260
  ? document.body
262
261
  : document.getElementsByTagName('body')[0]
263
262
  getEle.appendChild(createLoadingEle)
264
263
  const getEle = document.getElementById('J_shopLoading')
265
264
  getEle && getEle.remove()
266
265
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
267
266
  params,
268
267
  )
269
268
  if (!systemInfo.system && window) {
270
269
  systemInfo.system = window.navigator.userAgent
271
270
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
272
271
  }
273
272
  const isIOS = !!systemInfo?.system.match(/ios/i)
274
273
  const isAndroid = !!systemInfo?.system.match(/android/i)
275
274
  systemInfo.navBarHeight = 0
276
275
  systemInfo.statusBarHeight = 0
277
276
  systemInfo.capsulePosition = null
278
277
  systemInfo.isIOS = isIOS
279
278
  systemInfo.isAndroid = isAndroid
280
279
  _ShopSystemInfo = systemInfo
281
280
  return systemInfo
282
281
  return originDealShopContentData(pageData, sgmCustomReport, isvdev)
283
282
  const numScale = Number(scale)
284
283
  if(isNaN(numScale)){
285
284
  console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
286
285
  return false
287
286
  }
288
287
  const { venderId } = global.info.queryInfo || {}
289
288
  const id = venderId
290
289
  if(!id && numScale !== 1){
291
290
  return false
292
291
  }
293
292
  const useScale = Math.max(0, Math.min(1, numScale))
294
293
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
295
294
  if(reportKey){
296
295
  sgmCustomReport({
297
296
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
298
297
  msg: '灰度调用',
299
298
  })
300
299
  console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
301
300
  if(isMatch){
302
301
  sgmCustomReport({
303
302
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
304
303
  msg: '灰度命中',
305
304
  })
306
305
  console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
307
306
  }
308
307
  }
309
308
  return isMatch
310
309
  isJdApp,
311
310
  isWxApp,
312
311
  isIosDevice,
313
312
  isAndroidDevice,
314
313
  isJdAndIosDevice,
315
314
  isJdAndAndroidDevice,
316
315
  isJdAndHarmonyDevice,
317
316
  isJdAndroidX5Core,
318
317
  isMin,
319
318
  isWxMin,
320
319
  isWxMinAndWxapp,
321
320
  isJdMinAndHarmony,
322
321
  isJdMin,
323
322
  isH5,
324
323
  isH5AndJdShopView,
325
324
  isChartH5,
326
325
  isH5AndJdShopViewNativeScroll,
327
326
  isH5AndJdShopViewH5Scroll,
328
327
  isH5AndJdShopH5CustomScrollView,
329
328
  isH5AndJingGouMini,
330
329
  isWxMiniH5View,
331
330
  urlCookie,
332
331
  sliceArrToChunkList,
333
332
  dealAddress,
334
333
  objectToUrlEncode,
335
334
  parseQueryUrlString,
336
335
  setLowSmallPicUrl,
337
336
  setTaroStorage,
338
337
  getTaroStorageKeyValue,
339
338
  removeTaroStorageKey,
340
339
  clearTaroStorageKey,
341
340
  getAvifSupport,
342
341
  getWebpSupport,
343
342
  getQualityImage,
344
343
  countStringify,
345
344
  getWxAppCookieStr,
346
345
  getSystemInfos,
347
346
  pxTransformFromData,
348
347
  dealShopContentDataAndReport as dealShopContentData,
349
348
  dateFormat,
350
349
  throttle,
351
350
  lodashThrottle,
352
351
  debounce,
353
352
  addHttps,
354
353
  commonShowSuccessToast as showSuccessToast,
355
354
  commonShowFailToast as showFailToast,
356
355
  commonShowNormalToast as showNormalToast,
357
356
  showShopLoading,
358
357
  hideShopLoading,
359
358
  stopNativeScrollEvent,
360
359
  getAppChannelType,
361
360
  formatTabActiveMenuType,
362
361
  filterUrlQueryData,
363
362
  sgmCustomReport,
364
363
  draCustomReport,
365
364
  remoteCustomReport,
366
365
  isMemberPage,
367
366
  getFloorDataToDataDefines,
368
367
  isOpenJdAppUrl,
369
368
  jdOpenAppParams,
370
369
  createJdOpenAppUrl,
371
370
  isEmpty,
372
371
  getJdAppReportPageSource,
373
372
  isAppClassifyPage,
374
373
  isAppHomeForMarketPage,
375
374
  isImageOptimizeEnable,
376
375
  isPc,
377
376
  ipLoc_djd,
378
377
  isTjScence,
379
378
  isH5AdnJxMini,
380
379
  isTjM,
381
380
  isTjJxM,
382
381
  isTJApp,
383
382
  isH5AdnHaoWuJie,
384
383
  tjChannel,
385
384
  dealJdOpenAppData,
386
385
  jdAppVersionCompare,
387
386
  dealNativePixelToCssPixel,
388
387
  isAppStowShop,
389
388
  getSgmCustomCode,
390
389
  handleSgmCodeTaroVersion,
391
390
  isInGrayscale,
392
391
  isIpadDevice,
392
+ import Taro from '@tarojs/taro'
393
393
  nativePageShowToast,
394
394
  ToastAndroidType,
395
395
  ToastIosType,
396
396
  stopNativeScrollEvent,
397
397
  getAppChannelType,
398
398
  isAndroidDevice,
399
399
  isH5AndJdShopView,
400
400
  isChartH5,
401
401
  isH5AndJdShopViewNativeScroll,
402
402
  isIosDevice,
403
403
  isJdAndAndroidDevice,
404
404
  isJdAndIosDevice,
405
405
  isJdAndHarmonyDevice,
406
406
  isJdApp,
407
407
  isWxApp,
408
408
  isWxMiniH5View,
409
409
  isH5AndJingGouMini,
410
410
  urlCookie,
411
411
  sgmCustomReport,
412
412
  draCustomReport,
413
413
  remoteCustomReport,
414
414
  isMemberPage,
415
415
  isH5AndJdShopViewH5Scroll,
416
416
  isH5AndJdShopH5CustomScrollView,
417
417
  isAppClassifyPage,
418
418
  isAppHomeForMarketPage,
419
419
  isPc,
420
420
  ipLoc_djd,
421
421
  jdAppVersionCompare,
422
422
  dealNativePixelToCssPixel,
423
423
  isAppStowShop,
424
424
  isJdAndroidX5Core,
425
425
  isTjScence,
426
426
  isH5AdnJxMini,
427
427
  isTjM,
428
428
  isTjJxM,
429
429
  isTJApp,
430
430
  isH5AdnHaoWuJie,
431
431
  tjChannel,
432
432
  parseQueryUrlObj,
433
433
  isIpadDevice,
434
434
  addHttps,
435
435
  clearTaroStorageKey,
436
436
  countStringify,
437
437
  dateFormat,
438
438
  dealAddress,
439
439
  dealShopContentData as originDealShopContentData,
440
440
  debounce,
441
441
  filterUrlQueryData,
442
442
  formatTabActiveMenuType,
443
443
  getAvifSupport,
444
444
  getWebpSupport,
445
445
  getTaroStorageKeyValue,
446
446
  getWxAppCookieStr,
447
447
  isH5,
448
448
  isMin,
449
449
  isJdMin,
450
450
  isWxMin,
451
451
  isWxMinAndWxapp,
452
452
  isJdMinAndHarmony,
453
453
  lodashThrottle,
454
454
  objectToUrlEncode,
455
455
  parseQueryUrlString,
456
456
  removeTaroStorageKey,
457
457
  setLowSmallPicUrl,
458
458
  setTaroStorage,
459
459
  showFailToast,
460
460
  showNormalToast,
461
461
  showSuccessToast,
462
462
  sliceArrToChunkList,
463
463
  throttle,
464
464
  getQualityImageNew,
465
465
  getQualityImageOld,
466
466
  isOpenJdAppUrl,
467
467
  jdOpenAppParams,
468
468
  createJdOpenAppUrl,
469
469
  isEmpty,
470
470
  getJdAppReportPageSource,
471
471
  dealJdOpenAppData,
472
472
  SgmCustomCode,
473
473
  } from '../common/sgmCustomCode'
474
474
  const getNum = Number(num)
475
475
  let _changeLayoutWidth = layoutWidth
476
476
  if (!_changeLayoutWidth) {
477
477
  _changeLayoutWidth =
478
478
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
479
479
  ? _ShopSystemInfo.windowWidth
480
480
  : Taro.getSystemInfoSync()?.windowWidth
481
481
  }
482
482
  return Math.round((getNum / widthSize) * _changeLayoutWidth)
483
483
  changeSize,
484
484
  designWidth = 750,
485
485
  systemInfo,
486
486
  const getRootFontSize =
487
487
  (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750
488
488
  const getRealRootFontSize =
489
489
  getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize
490
490
  return Math.ceil(
491
491
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) *
492
492
  getRealRootFontSize,
493
493
  )
494
494
  console.log(
495
495
  '获取系统宽度systemInfo?.windowWidth',
496
496
  systemInfo?.windowWidth,
497
497
  'taroToTransformRoutimePXNumber(changeWidth)',
498
498
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
499
499
  )
500
500
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
501
501
  ? systemInfo?.windowWidth -
502
502
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
503
503
  : systemInfo?.windowWidth ?? 0
504
504
  const systemInfo = Taro.getSystemInfoSync()
505
505
  if (params && params?.pageWidth && params?.pageHeight) {
506
506
  systemInfo.windowWidth = params?.pageWidth
507
507
  systemInfo.windowHeight = params?.pageHeight
508
508
  console.warn("松果安卓app内获折叠屏信息重置系统信息宽度值",params,",systemInfo信息集合为",systemInfo)
509
509
  }else {
510
510
  if (isJdApp && isAndroidDevice && systemInfo) {
511
511
  const getWinWidth = window.innerWidth;
512
512
  const getWinHeight = window.innerHeight;
513
513
  const getScreenWidth = window.screen.width;
514
514
  const getScreenHeight = window.screen.height;
515
515
  const isLandscape = getScreenWidth >= getScreenHeight;
516
516
  const { windowWidth,windowHeight, screenWidth, screenHeight } = systemInfo
517
517
  if (windowWidth <= 0) {
518
518
  systemInfo.initWindowWidth = windowWidth;
519
519
  if(isLandscape){
520
520
  systemInfo.windowWidth = getScreenHeight
521
521
  systemInfo.windowHeight = getScreenWidth
522
522
  systemInfo.screenWidth = getScreenHeight
523
523
  systemInfo.screenHeight = getScreenWidth
524
524
  }else {
525
525
  systemInfo.windowWidth = getScreenWidth
526
526
  systemInfo.windowHeight = getScreenHeight
527
527
  systemInfo.screenWidth = getScreenWidth
528
528
  systemInfo.screenHeight = getScreenHeight
529
529
  }
530
530
  console.warn(`松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight}`)
531
531
  sgmCustomReport({
532
532
  type: 2,
533
533
  code: 'android_jdapp_width_error_info',
534
534
  msg: {
535
535
  title: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
536
536
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
537
537
  taroSysInfo: systemInfo
538
538
  }
539
539
  })
540
540
  }else {
541
541
  let _getChangeWinWidthState = false
542
542
  if( getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth){
543
543
  if(isLandscape){
544
544
  systemInfo.windowWidth = getScreenHeight
545
545
  systemInfo.windowHeight = getScreenWidth
546
546
  systemInfo.screenWidth = getScreenHeight
547
547
  systemInfo.screenHeight = getScreenWidth
548
548
  }else {
549
549
  systemInfo.windowWidth = getScreenWidth
550
550
  systemInfo.windowHeight = getScreenHeight
551
551
  systemInfo.screenWidth = getScreenWidth
552
552
  systemInfo.screenHeight = getScreenHeight
553
553
  }
554
554
  _getChangeWinWidthState = true
555
555
  }
556
556
  _getChangeWinWidthState && console.warn(`松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`)
557
557
  _getChangeWinWidthState && sgmCustomReport({
558
558
  type: 2,
559
559
  code: 'android_jdapp_width_error_info',
560
560
  msg: {
561
561
  title: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight}`,
562
562
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
563
563
  taroSysInfo: systemInfo
564
564
  }
565
565
  })
566
566
  }
567
567
  }
568
568
  }
569
569
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo)
570
570
  console.warn('====获取系统信息=====', systemInfo)
571
571
  return systemInfo
572
572
  let result: boolean | null = null
573
573
  return function() {
574
574
  if (result === null) {
575
575
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0
576
576
  if(!isJdApp){
577
577
  console.warn("🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~")
578
578
  isIgnoreOptimizeFromServer = true
579
579
  result = true
580
580
  return true
581
581
  }
582
582
  const enableAvifOptimize = appVersionCheckPass
583
583
  if(enableAvifOptimize){
584
584
  const configData = global.getDynamicConfig('avifSwitch')
585
585
  console.warn("🚗 ~~ file: utils.ts:196 ~~ global.getDynamicConfig ~~ buildType:", buildType)
586
586
  console.warn("🚗 ~~ file: utils.ts:197 ~~ global.getDynamicConfig ~~ configData:", configData)
587
587
  const { globalOn = true, ignoreOptimizeFromServer = false, page = {}, grayscale = {}, whiteList = [], blackList = [] } = configData || {}
588
588
  const {shopId = '0', venderId = '0'} = parseQueryUrlObj
589
589
  let imageEnableResult = true
590
590
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer
591
591
  console.warn("🚗 ~~ file: index.h5.ts:213 ~~ returnfunction ~~ grayscale[buildType]:", grayscale[buildType])
592
592
  if (blackList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
593
593
  imageEnableResult = false
594
594
  console.warn("🚗 ~~ file: utils.ts:198 命中黑名单~")
595
595
  }else if(whiteList.find(item => item.sId === Number(shopId) || item.vId === Number(venderId))){
596
596
  isIgnoreOptimizeFromServer = true
597
597
  imageEnableResult = true
598
598
  console.warn("🚗 ~~ file: utils.ts:205 命中白名单~")
599
599
  }else if(grayscale[buildType] && isInGrayscale(grayscale[buildType])){
600
600
  isIgnoreOptimizeFromServer = true
601
601
  imageEnableResult = true
602
602
  console.warn("🚗 ~~ file: utils.ts:214 命中灰度~")
603
603
  }else{
604
604
  imageEnableResult = globalOn === true || page[buildType] === true
605
605
  if(globalOn === true){
606
606
  isIgnoreOptimizeFromServer = true
607
607
  console.warn("🚗 ~~ file: utils.ts:220 走全局开关控制逻辑,开关已打开~")
608
608
  }else if(page[buildType] === true){
609
609
  console.warn("🚗 ~~ file: utils.ts:220 走页面开关控制逻辑,开关已打开~")
610
610
  }else{
611
611
  console.warn("🚗 ~~ file: utils.ts:220 走全局或页面开关控制逻辑,开关未打开!")
612
612
  }
613
613
  }
614
614
  result = imageEnableResult
615
615
  return imageEnableResult
616
616
  }else{
617
617
  result = false
618
618
  return false
619
619
  }
620
620
  } else {
621
621
  return result
622
622
  }
623
623
  }
624
624
  if(typeof options === 'object' && isImageOptimizeEnable()){
625
625
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer)
626
626
  }else{
627
627
  return getQualityImageOld(imgUrl, options)
628
628
  }
629
629
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
630
630
  windowWidth: window.innerWidth,
631
631
  containerWidth: getContainerWidth(buildType, {
632
632
  windowWidth: window.innerWidth,
633
633
  }),
634
634
  screenWidth: window.innerWidth,
635
635
  platform: '',
636
636
  model: '',
637
637
  system: '',
638
638
  }
639
639
  return getSystemInfo
640
640
  const params = Object.assign(
641
641
  {},
642
642
  {
643
643
  title: '',
644
644
  duration: 1500,
645
645
  },
646
646
  options,
647
647
  )
648
648
  params.duration = params.duration / 1000
649
649
  if (isJdApp) {
650
650
  const showSuccessType = isIosDevice
651
651
  ? ToastIosType.SUCCESS
652
652
  : ToastAndroidType.SUCCESS
653
653
  const duration = isAndroidDevice ? 0 : params.duration
654
654
  nativePageShowToast(options.title, showSuccessType, duration)
655
655
  console.log('执行原生toast success')
656
656
  } else {
657
657
  showSuccessToast(options)
658
658
  }
659
659
  const params = Object.assign(
660
660
  {},
661
661
  {
662
662
  title: '',
663
663
  duration: 1500,
664
664
  },
665
665
  options,
666
666
  )
667
667
  params.duration = params.duration / 1000
668
668
  if (isJdApp) {
669
669
  const showSuccessType = isIosDevice
670
670
  ? ToastIosType.FAIL
671
671
  : ToastAndroidType.FAIL
672
672
  const duration = isAndroidDevice ? 0 : params.duration
673
673
  nativePageShowToast(options.title, showSuccessType, duration)
674
674
  console.log('执行原生toast fail')
675
675
  } else {
676
676
  console.log('执行H5 toast fail')
677
677
  showFailToast(options)
678
678
  }
679
679
  const params = Object.assign(
680
680
  {},
681
681
  {
682
682
  title: '',
683
683
  duration: 1500,
684
684
  },
685
685
  options,
686
686
  )
687
687
  params.duration = params.duration / 1000
688
688
  if (isJdApp) {
689
689
  const showSuccessType = isIosDevice
690
690
  ? ToastIosType.NORMAL
691
691
  : ToastAndroidType.NORMAL
692
692
  const duration = isAndroidDevice ? 0 : params.duration
693
693
  nativePageShowToast(options.title, showSuccessType, duration)
694
694
  } else {
695
695
  showNormalToast(options)
696
696
  }
697
697
  const createLoadingEle = document.createElement('div')
698
698
  createLoadingEle.id = 'J_shopLoading'
699
699
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`
700
700
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
701
701
  <span class='d-shop-loading-icon'></span>
702
702
  <p class='d-shop-text'>${text}</p>
703
703
  </div>`
704
704
  const getEle = document.body
705
705
  ? document.body
706
706
  : document.getElementsByTagName('body')[0]
707
707
  getEle.appendChild(createLoadingEle)
708
708
  const getEle = document.getElementById('J_shopLoading')
709
709
  getEle && getEle.remove()
710
710
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(
711
711
  params,
712
712
  )
713
713
  if (!systemInfo.system && window) {
714
714
  systemInfo.system = window.navigator.userAgent
715
715
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i)
716
716
  }
717
717
  const isIOS = !!systemInfo?.system.match(/ios/i)
718
718
  const isAndroid = !!systemInfo?.system.match(/android/i)
719
719
  systemInfo.navBarHeight = 0
720
720
  systemInfo.statusBarHeight = 0
721
721
  systemInfo.capsulePosition = null
722
722
  systemInfo.isIOS = isIOS
723
723
  systemInfo.isAndroid = isAndroid
724
724
  _ShopSystemInfo = systemInfo
725
725
  return systemInfo
726
726
  return originDealShopContentData(pageData, sgmCustomReport, isvdev)
727
727
  const numScale = Number(scale)
728
728
  if(isNaN(numScale)){
729
729
  console.warn(`The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`)
730
730
  return false
731
731
  }
732
732
  const { venderId } = global.info.queryInfo || {}
733
733
  const id = venderId
734
734
  if(!id && numScale !== 1){
735
735
  return false
736
736
  }
737
737
  const useScale = Math.max(0, Math.min(1, numScale))
738
738
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0
739
739
  if(reportKey){
740
740
  sgmCustomReport({
741
741
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
742
742
  msg: '灰度调用',
743
743
  })
744
744
  console.log(`基于KEY[${reportKey}]的灰度调用1次~`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`))
745
745
  if(isMatch){
746
746
  sgmCustomReport({
747
747
  code: getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
748
748
  msg: '灰度命中',
749
749
  })
750
750
  console.log(`基于KEY[${reportKey}]的命中1次灰度!`, getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`))
751
751
  }
752
752
  }
753
753
  return isMatch
754
754
  isJdApp,
755
755
  isWxApp,
756
756
  isIosDevice,
757
757
  isAndroidDevice,
758
758
  isJdAndIosDevice,
759
759
  isJdAndAndroidDevice,
760
760
  isJdAndHarmonyDevice,
761
761
  isJdAndroidX5Core,
762
762
  isMin,
763
763
  isWxMin,
764
764
  isWxMinAndWxapp,
765
765
  isJdMinAndHarmony,
766
766
  isJdMin,
767
767
  isH5,
768
768
  isH5AndJdShopView,
769
769
  isChartH5,
770
770
  isH5AndJdShopViewNativeScroll,
771
771
  isH5AndJdShopViewH5Scroll,
772
772
  isH5AndJdShopH5CustomScrollView,
773
773
  isH5AndJingGouMini,
774
774
  isWxMiniH5View,
775
775
  urlCookie,
776
776
  sliceArrToChunkList,
777
777
  dealAddress,
778
778
  objectToUrlEncode,
779
779
  parseQueryUrlString,
780
780
  setLowSmallPicUrl,
781
781
  setTaroStorage,
782
782
  getTaroStorageKeyValue,
783
783
  removeTaroStorageKey,
784
784
  clearTaroStorageKey,
785
785
  getAvifSupport,
786
786
  getWebpSupport,
787
787
  getQualityImage,
788
788
  countStringify,
789
789
  getWxAppCookieStr,
790
790
  getSystemInfos,
791
791
  pxTransformFromData,
792
792
  dealShopContentDataAndReport as dealShopContentData,
793
793
  dateFormat,
794
794
  throttle,
795
795
  lodashThrottle,
796
796
  debounce,
797
797
  addHttps,
798
798
  commonShowSuccessToast as showSuccessToast,
799
799
  commonShowFailToast as showFailToast,
800
800
  commonShowNormalToast as showNormalToast,
801
801
  showShopLoading,
802
802
  hideShopLoading,
803
803
  stopNativeScrollEvent,
804
804
  getAppChannelType,
805
805
  formatTabActiveMenuType,
806
806
  filterUrlQueryData,
807
807
  sgmCustomReport,
808
808
  draCustomReport,
809
809
  remoteCustomReport,
810
810
  isMemberPage,
811
811
  getFloorDataToDataDefines,
812
812
  isOpenJdAppUrl,
813
813
  jdOpenAppParams,
814
814
  createJdOpenAppUrl,
815
815
  isEmpty,
816
816
  getJdAppReportPageSource,
817
817
  isAppClassifyPage,
818
818
  isAppHomeForMarketPage,
819
819
  isImageOptimizeEnable,
820
820
  isPc,
821
821
  ipLoc_djd,
822
822
  isTjScence,
823
823
  isH5AdnJxMini,
824
824
  isTjM,
825
825
  isTjJxM,
826
826
  isTJApp,
827
827
  isH5AdnHaoWuJie,
828
828
  tjChannel,
829
829
  dealJdOpenAppData,
830
830
  jdAppVersionCompare,
831
831
  dealNativePixelToCssPixel,
832
832
  isAppStowShop,
833
833
  getSgmCustomCode,
834
834
  handleSgmCodeTaroVersion,
835
835
  isInGrayscale,
836
836
  isIpadDevice,