@conecli/cone-render 0.9.1-shop2.19 → 0.9.1-shop2.20

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