@conecli/cone-render 0.10.1-beta.3 → 0.10.1-beta.5

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