@conecli/cone-render 0.9.1-shop2.12 → 0.9.1-shop2.14

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