@conecli/cone-render 0.9.1-shop2.16 → 0.9.1-shop2.18

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