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