@conecli/cone-render 0.10.1-shop3.76 → 0.10.1-shop3.79

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  stopNativeScrollEvent,
3
2
  getAppChannelType,
4
3
  isAndroidDevice,
5
4
  isHarmonyDevice,
6
5
  isH5AndJdShopView,
7
6
  isChartH5,
8
7
  isH5AndJdShopViewNativeScroll,
9
8
  isIosDevice,
10
9
  isJdAndAndroidDevice,
11
10
  isJdAndIosDevice,
12
11
  isJdApp,
13
12
  isWxApp,
14
13
  isWxMiniH5View,
15
14
  isJdAndHarmonyDevice,
16
15
  isNewHarmonyShop,
17
16
  isH5AndJingGouMini,
18
17
  urlCookie,
19
18
  draCustomReport,
20
19
  remoteCustomReport,
21
20
  draInterfaceCustomReport,
22
21
  draBusinessCustomReport,
23
22
  draBusinessCustomLogReport,
24
23
  isMemberPage,
25
24
  isH5AndJdShopViewH5Scroll,
26
25
  isH5AndJdShopH5CustomScrollView,
27
26
  isAppClassifyPage,
28
27
  isAppHomeForMarketPage,
29
28
  isPc,
30
29
  isPcClassifyPage,
31
30
  ipLoc_djd,
32
31
  jdAppVersionCompare,
33
32
  isTjScence,
34
33
  isH5AdnJxMini,
35
34
  isTjM,
36
35
  isTjJxM,
37
36
  isTJApp,
38
37
  isH5AdnHaoWuJie,
39
38
  tjChannel,
40
39
  dealNativePixelToCssPixel,
41
40
  isAppStowShop,
42
41
  isJdAndroidX5Core,
43
42
  parseQueryUrlObj,
44
43
  isIpadDevice,
45
44
  isTabletDevice,
46
45
  checkPadScreenOrientationIsLandscape,
47
46
  isSupportHybridHttpRequest,
48
47
  isLanguageForEn,
49
48
  sColor,
50
49
  isInJdShopView,
51
50
  isDongWebView,
52
51
  isLanguageForHk,
53
52
  languageNowType,
54
53
  isInJdAppH5DebugMode
55
54
  addHttps,
56
55
  clearTaroStorageKey,
57
56
  countStringify as h5CountStringify,
58
57
  dateFormat,
59
58
  dealAddress,
60
59
  dealShopContentData as originDealShopContentData,
61
60
  debounce,
62
61
  filterUrlQueryData,
63
62
  formatTabActiveMenuType,
64
63
  getAvifSupport,
65
64
  getWebpSupport,
66
65
  getTaroStorageKeyValue,
67
66
  getWxAppCookieStr,
68
67
  isH5,
69
68
  isMin,
70
69
  isJdMin,
71
70
  isWxMin,
72
71
  isWxMinAndWxapp,
73
72
  isJdMinAndHarmony,
74
73
  lodashThrottle,
75
74
  objectToUrlEncode,
76
75
  parseQueryUrlString,
77
76
  removeTaroStorageKey,
78
77
  setLowSmallPicUrl,
79
78
  setTaroStorage,
80
79
  showFailToast,
81
80
  showNormalToast,
82
81
  showSuccessToast,
83
82
  sliceArrToChunkList,
84
83
  throttle,
85
84
  getQualityImageNew,
86
85
  getQualityImageOld,
87
86
  isOpenJdAppUrl,
88
87
  jdOpenAppParams,
89
88
  createJdOpenAppUrl,
90
89
  isEmpty,
91
90
  getJdAppReportPageSource,
92
91
  dealJdOpenAppData,
93
92
  getBorderStyle,
94
93
  isInHarmonyBlacklistByModuleFlag,
95
94
  const getNum = Number(num);
96
95
  let _changeLayoutWidth = layoutWidth;
97
96
  if (!_changeLayoutWidth) {
98
97
  _changeLayoutWidth =
99
98
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
100
99
  ? _ShopSystemInfo.windowWidth
101
100
  : Taro.getSystemInfoSync()?.windowWidth;
102
101
  }
103
102
  return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
104
103
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
105
104
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
106
105
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
107
106
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
108
107
  if (_ShopSystemInfo?.isJdTabletDevice) {
109
108
  getRealRootFontSize = Math.floor(
110
109
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
111
110
  );
112
111
  }
113
112
  return Math.ceil(
114
113
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
115
114
  );
116
115
  console.log(
117
116
  '获取系统宽度systemInfo?.windowWidth',
118
117
  systemInfo?.windowWidth,
119
118
  'taroToTransformRoutimePXNumber(changeWidth)',
120
119
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
121
120
  );
122
121
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
123
122
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
124
123
  : systemInfo?.windowWidth ?? 0;
125
124
  const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync();
126
125
  console.log(
127
126
  '获取系统宽度systemInfo?.windowWidth',
128
127
  systemInfo?.windowWidth,
129
128
  'taroToTransformRoutimePXNumber(changeWidth)',
130
129
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
131
130
  );
132
131
  const containerWidth =
133
132
  isClassify && systemInfo?.windowWidth
134
133
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
135
134
  : systemInfo?.windowWidth ?? 0;
136
135
  if (global?.info?.sysInfo) {
137
136
  global.info.sysInfo['containerWidth'] = containerWidth;
138
137
  }
139
138
  return (
140
139
  isJdApp &&
141
140
  (parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
142
141
  );
143
142
  const systemInfo = Taro.getSystemInfoSync();
144
143
  if (params && params?.pageWidth && params?.pageHeight) {
145
144
  systemInfo.windowWidth = params?.pageWidth;
146
145
  systemInfo.windowHeight = params?.pageHeight;
147
146
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
148
147
  } else {
149
148
  if (isPc) {
150
149
  systemInfo.windowWidth = 375;
151
150
  } else {
152
151
  const getWinWidth = window.innerWidth;
153
152
  const getWinHeight = window.innerHeight;
154
153
  const getScreenWidth = window.screen.width;
155
154
  const getScreenHeight = window.screen.height;
156
155
  const getRootEleInitWidth = params?.rootEleInitWidth || 0;
157
156
  const isReplaceSystemWidth = params?.replaceSystemWidth || false;
158
157
  systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
159
158
  systemInfo.isJdTabletLandscape =
160
159
  systemInfo.isJdTabletDevice &&
161
160
  checkPadScreenOrientationIsLandscape(getRootEleInitWidth, getScreenWidth, getScreenHeight);
162
161
  if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
163
162
  if (systemInfo?.windowWidth <= 0) {
164
163
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
165
164
  systemInfo.windowHeight = getScreenHeight;
166
165
  console.warn(
167
166
  '====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
168
167
  systemInfo.windowWidth,
169
168
  'getRootEleInitWidth',
170
169
  getRootEleInitWidth,
171
170
  'getScreenWidth',
172
171
  getScreenWidth,
173
172
  'getScreenHeight',
174
173
  getScreenHeight,
175
174
  );
176
175
  draBusinessCustomReport({
177
176
  eventName: 'business',
178
177
  errorName: 'jdapp_pad_width_error_info',
179
178
  errorMessage: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
180
179
  extraData: JSON.stringify({
181
180
  isJdApp,
182
181
  isAndroidDevice,
183
182
  getScreenWidth,
184
183
  getScreenHeight,
185
184
  getWinWidth,
186
185
  getWinHeight,
187
186
  getRootEleInitWidth,
188
187
  }),
189
188
  });
190
189
  }
191
190
  } else {
192
191
  if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
193
192
  const isLandscape = getScreenWidth >= getScreenHeight;
194
193
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
195
194
  if (windowWidth <= 0) {
196
195
  systemInfo.initWindowWidth = windowWidth;
197
196
  if (isLandscape) {
198
197
  systemInfo.windowWidth = getScreenHeight;
199
198
  systemInfo.windowHeight = getScreenWidth;
200
199
  systemInfo.screenWidth = getScreenHeight;
201
200
  systemInfo.screenHeight = getScreenWidth;
202
201
  } else {
203
202
  systemInfo.windowWidth = getScreenWidth;
204
203
  systemInfo.windowHeight = getScreenHeight;
205
204
  systemInfo.screenWidth = getScreenWidth;
206
205
  systemInfo.screenHeight = getScreenHeight;
207
206
  }
208
207
  console.warn(
209
208
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
210
209
  );
211
210
  draBusinessCustomReport({
212
211
  eventName: 'UIInteract',
213
212
  errorName: 'android_jdapp_width_error_info',
214
213
  errorMessage: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
215
214
  extraData: JSON.stringify({
216
215
  isJdApp,
217
216
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
218
217
  getScreenWidth,
219
218
  getScreenHeight,
220
219
  getWinWidth,
221
220
  getWinHeight,
222
221
  getRootEleInitWidth,
223
222
  }),
224
223
  });
225
224
  } else {
226
225
  let _getChangeWinWidthState = false;
227
226
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
228
227
  if (isLandscape) {
229
228
  systemInfo.windowWidth = getScreenHeight;
230
229
  systemInfo.windowHeight = getScreenWidth;
231
230
  systemInfo.screenWidth = getScreenHeight;
232
231
  systemInfo.screenHeight = getScreenWidth;
233
232
  } else {
234
233
  systemInfo.windowWidth = getScreenWidth;
235
234
  systemInfo.windowHeight = getScreenHeight;
236
235
  systemInfo.screenWidth = getScreenWidth;
237
236
  systemInfo.screenHeight = getScreenHeight;
238
237
  }
239
238
  _getChangeWinWidthState = true;
240
239
  }
241
240
  _getChangeWinWidthState &&
242
241
  console.warn(
243
242
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
244
243
  );
245
244
  if (_getChangeWinWidthState) {
246
245
  draBusinessCustomReport({
247
246
  eventName: 'business',
248
247
  errorName: 'android_jdapp_width_error_info_2',
249
248
  errorMessage: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
250
249
  extraData: JSON.stringify({
251
250
  isJdApp,
252
251
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
253
252
  getScreenWidth,
254
253
  getScreenHeight,
255
254
  getWinWidth,
256
255
  getWinHeight,
257
256
  getRootEleInitWidth,
258
257
  }),
259
258
  });
260
259
  }
261
260
  }
262
261
  }
263
262
  }
264
263
 
265
264
  if (systemInfo.isJdTabletDevice) {
266
265
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
267
266
  systemInfo.windowHeight = Math.max(getScreenWidth, getScreenHeight);
268
267
  if (systemInfo.isJdTabletLandscape) {
269
268
  const getRenderCenterState = window?.PAGE_DATA?.businessData?.fitPadCenterRenderLowVersion
270
269
  ? jdAppVersionCompare(window.PAGE_DATA.businessData.fitPadCenterRenderLowVersion) < 0
271
270
  : false;
272
271
  if (getRenderCenterState && window?.PAGE_DATA) {
273
272
  window.PAGE_DATA.isFitJdPadRenderCenter = true;
274
273
  }
275
274
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
276
275
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
277
276
  systemInfo.windowHeight = Math.max(
278
277
  getRootEleInitWidth,
279
278
  getScreenWidth,
280
279
  getScreenHeight,
281
280
  );
282
281
  } else {
283
282
  systemInfo.windowWidth = Math.max(getRootEleInitWidth, getScreenWidth, getScreenHeight);
284
283
  systemInfo.windowHeight = Math.min(
285
284
  getRootEleInitWidth,
286
285
  getScreenWidth,
287
286
  getScreenHeight,
288
287
  );
289
288
  }
290
289
  }
291
290
  console.warn(
292
291
  '====初始化获取当前设备是否是平板设备,是否横屏====',
293
292
  systemInfo.isJdTabletDevice,
294
293
  systemInfo.isJdTabletLandscape,
295
294
  '屏幕信息',
296
295
  window.screen,
297
296
  'getScreenWidth',
298
297
  getScreenWidth,
299
298
  'getScreenHeight',
300
299
  getScreenHeight,
301
300
  'getRootEleInitWidth',
302
301
  getRootEleInitWidth,
303
302
  '当前是否要求居中展示,居中展示那么宽高值要对调',
304
303
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
305
304
  '当前pad最终展示的窗口宽度',
306
305
  systemInfo.windowWidth,
307
306
  );
308
307
  }
309
308
  }
310
309
  }
311
310
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
312
311
  console.warn('====获取系统信息=====', systemInfo);
313
312
  return systemInfo;
314
313
  let result: boolean | null = null;
315
314
  return function () {
316
315
  if (result === null) {
317
316
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
318
317
  if (!isJdApp) {
319
318
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
320
319
  isIgnoreOptimizeFromServer = true;
321
320
  result = true;
322
321
  return true;
323
322
  }
324
323
  const enableAvifOptimize = appVersionCheckPass;
325
324
  if (enableAvifOptimize) {
326
325
  const configData = global?.getDynamicConfig('avifSwitch');
327
326
  const {
328
327
  globalOn = true,
329
328
  ignoreOptimizeFromServer = false,
330
329
  page = {},
331
330
  grayscale = {},
332
331
  whiteList = [],
333
332
  blackList = [],
334
333
  } = configData || {};
335
334
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
336
335
  let imageEnableResult = true;
337
336
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
338
337
  if (
339
338
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
340
339
  ) {
341
340
  imageEnableResult = false;
342
341
  } else if (
343
342
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
344
343
  ) {
345
344
  isIgnoreOptimizeFromServer = true;
346
345
  imageEnableResult = true;
347
346
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
348
347
  isIgnoreOptimizeFromServer = true;
349
348
  imageEnableResult = true;
350
349
  } else {
351
350
  imageEnableResult = globalOn === true || page[buildType] === true;
352
351
  if (globalOn === true) {
353
352
  isIgnoreOptimizeFromServer = true;
354
353
  } else if (page[buildType] === true) {
355
354
  } else {
356
355
  }
357
356
  }
358
357
  result = imageEnableResult;
359
358
  return imageEnableResult;
360
359
  } else {
361
360
  result = false;
362
361
  return false;
363
362
  }
364
363
  } else {
365
364
  return result;
366
365
  }
367
366
  };
368
367
  if (typeof options === 'object' && isImageOptimizeEnable()) {
369
368
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
370
369
  } else {
371
370
  return getQualityImageOld(imgUrl, options);
372
371
  }
373
372
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
374
373
  windowWidth: window.innerWidth,
375
374
  containerWidth: getContainerWidth(buildType, {
376
375
  windowWidth: window.innerWidth,
377
376
  }),
378
377
  screenWidth: window.innerWidth,
379
378
  platform: '',
380
379
  model: '',
381
380
  system: '',
382
381
  };
383
382
  return getSystemInfo;
384
383
  const params = Object.assign(
385
384
  {},
386
385
  {
387
386
  title: '',
388
387
  duration: 1500,
389
388
  },
390
389
  options,
391
390
  );
392
391
  params.duration = params.duration / 1000;
393
392
  if (isJdApp && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
394
393
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
395
394
  const duration = isAndroidDevice ? 0 : params.duration;
396
395
  nativePageShowToast(options.title, showSuccessType, duration);
397
396
  console.log('执行原生toast success');
398
397
  } else {
399
398
  showSuccessToast(options);
400
399
  }
401
400
  const params = Object.assign(
402
401
  {},
403
402
  {
404
403
  title: '',
405
404
  duration: 1500,
406
405
  },
407
406
  options,
408
407
  );
409
408
  params.duration = params.duration / 1000;
410
409
  if (isJdApp && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
411
410
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
412
411
  const duration = isAndroidDevice ? 0 : params.duration;
413
412
  nativePageShowToast(options.title, showSuccessType, duration);
414
413
  console.log('执行原生toast fail');
415
414
  } else {
416
415
  console.log('执行H5 toast fail');
417
416
  showFailToast(options);
418
417
  }
419
418
  const params = Object.assign(
420
419
  {},
421
420
  {
422
421
  title: '',
423
422
  duration: 1500,
424
423
  },
425
424
  options,
426
425
  );
427
426
  params.duration = params.duration / 1000;
428
427
  if (isJdApp && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
429
428
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
430
429
  const duration = isAndroidDevice ? 0 : params.duration;
431
430
  nativePageShowToast(options.title, showSuccessType, duration);
432
431
  } else {
433
432
  showNormalToast(options);
434
433
  }
435
434
  if (isLanguageForEn) {
436
435
  count = Number(count);
437
436
  if (count >= 1000000000) {
438
437
  return (count / 1000000000).toFixed(fixedNum) + 'B';
439
438
  } else if (count >= 1000000) {
440
439
  return (count / 1000000).toFixed(fixedNum) + 'M';
441
440
  } else if (count >= 1000) {
442
441
  return (count / 1000).toFixed(fixedNum) + 'K';
443
442
  } else {
444
443
  return count;
445
444
  }
446
445
  } else {
447
446
  return h5CountStringify(count, fixedNum, unit, maxNum);
448
447
  }
449
448
  const createLoadingEle = document.createElement('div');
450
449
  createLoadingEle.id = 'J_shopLoading';
451
450
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
452
451
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
453
452
  <span class='d-shop-loading-icon'></span>
454
453
  <p class='d-shop-text'>${text}</p>
455
454
  </div>`;
456
455
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
457
456
  getEle.appendChild(createLoadingEle);
458
457
  const getEle = document.getElementById('J_shopLoading');
459
458
  getEle && getEle.remove();
460
459
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
461
460
  if (!systemInfo.system && window) {
462
461
  systemInfo.system = window.navigator.userAgent;
463
462
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
464
463
  }
465
464
  const isIOS = !!systemInfo?.system.match(/ios/i);
466
465
  const isAndroid = !!systemInfo?.system.match(/android/i);
467
466
  systemInfo.navBarHeight = 0;
468
467
  systemInfo.statusBarHeight = 0;
469
468
  systemInfo.capsulePosition = null;
470
469
  systemInfo.isIOS = isIOS;
471
470
  systemInfo.isAndroid = isAndroid;
472
471
  _ShopSystemInfo = systemInfo;
473
472
  return systemInfo;
474
473
  const result = originDealShopContentData(pageData, draBusinessCustomReport, isvdev);
475
474
  if (isJdAndHarmonyDevice && isNewHarmonyShop) {
476
475
  result.shopContentContainerListData = result.shopContentContainerListData.filter(
477
476
  (item) =>
478
477
  item.floors.length > 0 &&
479
478
  !isInHarmonyBlacklistByModuleFlag(item.containerId, result.shopContentContainerListData),
480
479
  );
481
480
  }
482
481
  return result;
483
482
  const numScale = Number(scale);
484
483
  if (isNaN(numScale)) {
485
484
  console.warn(
486
485
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
487
486
  );
488
487
  return false;
489
488
  }
490
489
  const { venderId } = global.info.queryInfo || {};
491
490
  const id = venderId;
492
491
  if (!id && numScale !== 1) {
493
492
  return false;
494
493
  }
495
494
  const useScale = Math.max(0, Math.min(1, numScale));
496
495
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
497
496
  if (reportKey) {
498
497
  console.log(
499
498
  `基于KEY[${reportKey}]的灰度调用1次~`,
500
499
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
501
500
  );
502
501
  if (isMatch) {
503
502
  console.log(
504
503
  `基于KEY[${reportKey}]的命中1次灰度!`,
505
504
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
506
505
  );
507
506
  }
508
507
  }
509
508
  return isMatch;
510
509
  isJdApp,
511
510
  isWxApp,
512
511
  isIosDevice,
513
512
  isAndroidDevice,
514
513
  isHarmonyDevice,
515
514
  isJdAndIosDevice,
516
515
  isJdAndAndroidDevice,
517
516
  isJdAndHarmonyDevice,
518
517
  isNewHarmonyShop,
519
518
  isJdAndroidX5Core,
520
519
  isMin,
521
520
  isWxMin,
522
521
  isWxMinAndWxapp,
523
522
  isJdMinAndHarmony,
524
523
  isJdMin,
525
524
  isH5,
526
525
  isH5AndJdShopView,
527
526
  isChartH5,
528
527
  isH5AndJdShopViewNativeScroll,
529
528
  isH5AndJdShopViewH5Scroll,
530
529
  isH5AndJdShopH5CustomScrollView,
531
530
  isH5AndJingGouMini,
532
531
  isWxMiniH5View,
533
532
  urlCookie,
534
533
  sliceArrToChunkList,
535
534
  dealAddress,
536
535
  objectToUrlEncode,
537
536
  parseQueryUrlString,
538
537
  setLowSmallPicUrl,
539
538
  setTaroStorage,
540
539
  getTaroStorageKeyValue,
541
540
  removeTaroStorageKey,
542
541
  clearTaroStorageKey,
543
542
  getAvifSupport,
544
543
  getWebpSupport,
545
544
  getQualityImage,
546
545
  formatCountForUnit as countStringify,
547
546
  getWxAppCookieStr,
548
547
  getSystemInfos,
549
548
  pxTransformFromData,
550
549
  dealShopContentDataAndReport as dealShopContentData,
551
550
  dateFormat,
552
551
  throttle,
553
552
  lodashThrottle,
554
553
  debounce,
555
554
  addHttps,
556
555
  commonShowSuccessToast as showSuccessToast,
557
556
  commonShowFailToast as showFailToast,
558
557
  commonShowNormalToast as showNormalToast,
559
558
  showShopLoading,
560
559
  hideShopLoading,
561
560
  stopNativeScrollEvent,
562
561
  getAppChannelType,
563
562
  formatTabActiveMenuType,
564
563
  filterUrlQueryData,
565
564
  draCustomReport,
566
565
  remoteCustomReport,
567
566
  draInterfaceCustomReport,
568
567
  draBusinessCustomReport,
569
568
  draBusinessCustomLogReport,
570
569
  isMemberPage,
571
570
  getFloorDataToDataDefines,
572
571
  isOpenJdAppUrl,
573
572
  jdOpenAppParams,
574
573
  createJdOpenAppUrl,
575
574
  isEmpty,
576
575
  getJdAppReportPageSource,
577
576
  isAppClassifyPage,
578
577
  isAppHomeForMarketPage,
579
578
  isImageOptimizeEnable,
580
579
  isPc,
581
580
  isPcClassifyPage,
582
581
  ipLoc_djd,
583
582
  isTjScence,
584
583
  isH5AdnJxMini,
585
584
  isTjM,
586
585
  isTjJxM,
587
586
  isTJApp,
588
587
  isH5AdnHaoWuJie,
589
588
  tjChannel,
590
589
  dealJdOpenAppData,
591
590
  jdAppVersionCompare,
592
591
  dealNativePixelToCssPixel,
593
592
  isAppStowShop,
594
593
  getSgmCustomCode,
595
594
  handleSgmCodeTaroVersion,
596
595
  isInGrayscale,
597
596
  isIpadDevice,
598
597
  getBorderStyle,
599
598
  isSupportHybridHttpRequest,
600
599
  isLanguageForEn,
601
600
  sColor,
602
601
  isTabletDevice,
603
602
  taroToTransformRoutimePXNumber,
604
603
  updateContainerWidth,
605
604
  isInJdShopView,
606
605
  isDongWebView,
607
606
  isLanguageForHk,
608
607
  languageNowType,
609
608
  isInJdAppH5DebugMode
609
+ import Taro from '@tarojs/taro';
610
610
  stopNativeScrollEvent,
611
611
  getAppChannelType,
612
612
  isAndroidDevice,
613
613
  isHarmonyDevice,
614
614
  isH5AndJdShopView,
615
615
  isChartH5,
616
616
  isH5AndJdShopViewNativeScroll,
617
617
  isIosDevice,
618
618
  isJdAndAndroidDevice,
619
619
  isJdAndIosDevice,
620
620
  isJdApp,
621
621
  isWxApp,
622
622
  isWxMiniH5View,
623
623
  isJdAndHarmonyDevice,
624
624
  isNewHarmonyShop,
625
625
  isH5AndJingGouMini,
626
626
  urlCookie,
627
627
  draCustomReport,
628
628
  remoteCustomReport,
629
629
  draInterfaceCustomReport,
630
630
  draBusinessCustomReport,
631
631
  draBusinessCustomLogReport,
632
632
  isMemberPage,
633
633
  isH5AndJdShopViewH5Scroll,
634
634
  isH5AndJdShopH5CustomScrollView,
635
635
  isAppClassifyPage,
636
636
  isAppHomeForMarketPage,
637
637
  isPc,
638
638
  isPcClassifyPage,
639
639
  ipLoc_djd,
640
640
  jdAppVersionCompare,
641
641
  isTjScence,
642
642
  isH5AdnJxMini,
643
643
  isTjM,
644
644
  isTjJxM,
645
645
  isTJApp,
646
646
  isH5AdnHaoWuJie,
647
647
  tjChannel,
648
648
  dealNativePixelToCssPixel,
649
649
  isAppStowShop,
650
650
  isJdAndroidX5Core,
651
651
  parseQueryUrlObj,
652
652
  isIpadDevice,
653
653
  isTabletDevice,
654
654
  checkPadScreenOrientationIsLandscape,
655
655
  isSupportHybridHttpRequest,
656
656
  isLanguageForEn,
657
657
  sColor,
658
658
  isInJdShopView,
659
659
  isDongWebView,
660
660
  isLanguageForHk,
661
661
  languageNowType,
662
662
  isInJdAppH5DebugMode,
663
663
  isJdLiteApp,
664
664
  isJdAppForNotMain,
665
665
  addHttps,
666
666
  clearTaroStorageKey,
667
667
  countStringify as h5CountStringify,
668
668
  dateFormat,
669
669
  dealAddress,
670
670
  dealShopContentData as originDealShopContentData,
671
671
  debounce,
672
672
  filterUrlQueryData,
673
673
  formatTabActiveMenuType,
674
674
  getAvifSupport,
675
675
  getWebpSupport,
676
676
  getTaroStorageKeyValue,
677
677
  getWxAppCookieStr,
678
678
  isH5,
679
679
  isMin,
680
680
  isJdMin,
681
681
  isWxMin,
682
682
  isWxMinAndWxapp,
683
683
  isJdMinAndHarmony,
684
684
  lodashThrottle,
685
685
  objectToUrlEncode,
686
686
  parseQueryUrlString,
687
687
  removeTaroStorageKey,
688
688
  setLowSmallPicUrl,
689
689
  setTaroStorage,
690
690
  showFailToast,
691
691
  showNormalToast,
692
692
  showSuccessToast,
693
693
  sliceArrToChunkList,
694
694
  throttle,
695
695
  getQualityImageNew,
696
696
  getQualityImageOld,
697
697
  isOpenJdAppUrl,
698
698
  jdOpenAppParams,
699
699
  createJdOpenAppUrl,
700
700
  isEmpty,
701
701
  getJdAppReportPageSource,
702
702
  dealJdOpenAppData,
703
703
  getBorderStyle,
704
704
  isInHarmonyBlacklistByModuleFlag,
705
705
  const getNum = Number(num);
706
706
  let _changeLayoutWidth = layoutWidth;
707
707
  if (!_changeLayoutWidth) {
708
708
  _changeLayoutWidth =
709
709
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
710
710
  ? _ShopSystemInfo.windowWidth
711
711
  : Taro.getSystemInfoSync()?.windowWidth;
712
712
  }
713
713
  return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
714
714
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
715
715
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
716
716
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
717
717
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
718
718
  if (_ShopSystemInfo?.isJdTabletDevice) {
719
719
  getRealRootFontSize = Math.floor(
720
720
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
721
721
  );
722
722
  }
723
723
  return Math.ceil(
724
724
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
725
725
  );
726
726
  console.log(
727
727
  '获取系统宽度systemInfo?.windowWidth',
728
728
  systemInfo?.windowWidth,
729
729
  'taroToTransformRoutimePXNumber(changeWidth)',
730
730
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
731
731
  );
732
732
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
733
733
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
734
734
  : systemInfo?.windowWidth ?? 0;
735
735
  const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync();
736
736
  console.log(
737
737
  '获取系统宽度systemInfo?.windowWidth',
738
738
  systemInfo?.windowWidth,
739
739
  'taroToTransformRoutimePXNumber(changeWidth)',
740
740
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
741
741
  );
742
742
  const containerWidth =
743
743
  isClassify && systemInfo?.windowWidth
744
744
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
745
745
  : systemInfo?.windowWidth ?? 0;
746
746
  if (global?.info?.sysInfo) {
747
747
  global.info.sysInfo['containerWidth'] = containerWidth;
748
748
  }
749
749
  return (
750
750
  isJdApp &&
751
751
  (parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
752
752
  );
753
753
  const systemInfo = Taro.getSystemInfoSync();
754
754
  if (params && params?.pageWidth && params?.pageHeight) {
755
755
  systemInfo.windowWidth = params?.pageWidth;
756
756
  systemInfo.windowHeight = params?.pageHeight;
757
757
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
758
758
  } else {
759
759
  if (isPc) {
760
760
  systemInfo.windowWidth = 375;
761
761
  } else {
762
762
  const getWinWidth = window.innerWidth;
763
763
  const getWinHeight = window.innerHeight;
764
764
  const getScreenWidth = window.screen.width;
765
765
  const getScreenHeight = window.screen.height;
766
766
  const getRootEleInitWidth = params?.rootEleInitWidth || 0;
767
767
  const isReplaceSystemWidth = params?.replaceSystemWidth || false;
768
768
  systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
769
769
  systemInfo.isJdTabletLandscape =
770
770
  systemInfo.isJdTabletDevice &&
771
771
  checkPadScreenOrientationIsLandscape(getRootEleInitWidth, getScreenWidth, getScreenHeight);
772
772
  if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
773
773
  if (systemInfo?.windowWidth <= 0) {
774
774
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
775
775
  systemInfo.windowHeight = getScreenHeight;
776
776
  console.warn(
777
777
  '====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
778
778
  systemInfo.windowWidth,
779
779
  'getRootEleInitWidth',
780
780
  getRootEleInitWidth,
781
781
  'getScreenWidth',
782
782
  getScreenWidth,
783
783
  'getScreenHeight',
784
784
  getScreenHeight,
785
785
  );
786
786
  draBusinessCustomReport({
787
787
  eventName: 'business',
788
788
  errorName: 'jdapp_pad_width_error_info',
789
789
  errorMessage: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
790
790
  extraData: JSON.stringify({
791
791
  isJdApp,
792
792
  isAndroidDevice,
793
793
  getScreenWidth,
794
794
  getScreenHeight,
795
795
  getWinWidth,
796
796
  getWinHeight,
797
797
  getRootEleInitWidth,
798
798
  }),
799
799
  });
800
800
  }
801
801
  } else {
802
802
  if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
803
803
  const isLandscape = getScreenWidth >= getScreenHeight;
804
804
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
805
805
  if (windowWidth <= 0) {
806
806
  systemInfo.initWindowWidth = windowWidth;
807
807
  if (isLandscape) {
808
808
  systemInfo.windowWidth = getScreenHeight;
809
809
  systemInfo.windowHeight = getScreenWidth;
810
810
  systemInfo.screenWidth = getScreenHeight;
811
811
  systemInfo.screenHeight = getScreenWidth;
812
812
  } else {
813
813
  systemInfo.windowWidth = getScreenWidth;
814
814
  systemInfo.windowHeight = getScreenHeight;
815
815
  systemInfo.screenWidth = getScreenWidth;
816
816
  systemInfo.screenHeight = getScreenHeight;
817
817
  }
818
818
  console.warn(
819
819
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
820
820
  );
821
821
  draBusinessCustomReport({
822
822
  eventName: 'UIInteract',
823
823
  errorName: 'android_jdapp_width_error_info',
824
824
  errorMessage: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
825
825
  extraData: JSON.stringify({
826
826
  isJdApp,
827
827
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
828
828
  getScreenWidth,
829
829
  getScreenHeight,
830
830
  getWinWidth,
831
831
  getWinHeight,
832
832
  getRootEleInitWidth,
833
833
  }),
834
834
  });
835
835
  } else {
836
836
  let _getChangeWinWidthState = false;
837
837
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
838
838
  if (isLandscape) {
839
839
  systemInfo.windowWidth = getScreenHeight;
840
840
  systemInfo.windowHeight = getScreenWidth;
841
841
  systemInfo.screenWidth = getScreenHeight;
842
842
  systemInfo.screenHeight = getScreenWidth;
843
843
  } else {
844
844
  systemInfo.windowWidth = getScreenWidth;
845
845
  systemInfo.windowHeight = getScreenHeight;
846
846
  systemInfo.screenWidth = getScreenWidth;
847
847
  systemInfo.screenHeight = getScreenHeight;
848
848
  }
849
849
  _getChangeWinWidthState = true;
850
850
  }
851
851
  _getChangeWinWidthState &&
852
852
  console.warn(
853
853
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
854
854
  );
855
855
  if (_getChangeWinWidthState) {
856
856
  draBusinessCustomReport({
857
857
  eventName: 'business',
858
858
  errorName: 'android_jdapp_width_error_info_2',
859
859
  errorMessage: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
860
860
  extraData: JSON.stringify({
861
861
  isJdApp,
862
862
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
863
863
  getScreenWidth,
864
864
  getScreenHeight,
865
865
  getWinWidth,
866
866
  getWinHeight,
867
867
  getRootEleInitWidth,
868
868
  }),
869
869
  });
870
870
  }
871
871
  }
872
872
  }
873
873
  }
874
874
 
875
875
  if (systemInfo.isJdTabletDevice) {
876
876
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
877
877
  systemInfo.windowHeight = Math.max(getScreenWidth, getScreenHeight);
878
878
  if (systemInfo.isJdTabletLandscape) {
879
879
  const getRenderCenterState = window?.PAGE_DATA?.businessData?.fitPadCenterRenderLowVersion
880
880
  ? jdAppVersionCompare(window.PAGE_DATA.businessData.fitPadCenterRenderLowVersion) < 0
881
881
  : false;
882
882
  if (getRenderCenterState && window?.PAGE_DATA) {
883
883
  window.PAGE_DATA.isFitJdPadRenderCenter = true;
884
884
  }
885
885
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
886
886
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
887
887
  systemInfo.windowHeight = Math.max(
888
888
  getRootEleInitWidth,
889
889
  getScreenWidth,
890
890
  getScreenHeight,
891
891
  );
892
892
  } else {
893
893
  systemInfo.windowWidth = Math.max(getRootEleInitWidth, getScreenWidth, getScreenHeight);
894
894
  systemInfo.windowHeight = Math.min(
895
895
  getRootEleInitWidth,
896
896
  getScreenWidth,
897
897
  getScreenHeight,
898
898
  );
899
899
  }
900
900
  }
901
901
  console.warn(
902
902
  '====初始化获取当前设备是否是平板设备,是否横屏====',
903
903
  systemInfo.isJdTabletDevice,
904
904
  systemInfo.isJdTabletLandscape,
905
905
  '屏幕信息',
906
906
  window.screen,
907
907
  'getScreenWidth',
908
908
  getScreenWidth,
909
909
  'getScreenHeight',
910
910
  getScreenHeight,
911
911
  'getRootEleInitWidth',
912
912
  getRootEleInitWidth,
913
913
  '当前是否要求居中展示,居中展示那么宽高值要对调',
914
914
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
915
915
  '当前pad最终展示的窗口宽度',
916
916
  systemInfo.windowWidth,
917
917
  );
918
918
  }
919
919
  }
920
920
  }
921
921
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
922
922
  console.warn('====获取系统信息=====', systemInfo);
923
923
  return systemInfo;
924
924
  let result: boolean | null = null;
925
925
  return function () {
926
926
  if (result === null) {
927
927
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
928
928
  if (!isJdApp) {
929
929
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
930
930
  isIgnoreOptimizeFromServer = true;
931
931
  result = true;
932
932
  return true;
933
933
  }
934
934
  const enableAvifOptimize = appVersionCheckPass;
935
935
  if (enableAvifOptimize) {
936
936
  const configData = global?.getDynamicConfig('avifSwitch');
937
937
  const {
938
938
  globalOn = true,
939
939
  ignoreOptimizeFromServer = false,
940
940
  page = {},
941
941
  grayscale = {},
942
942
  whiteList = [],
943
943
  blackList = [],
944
944
  } = configData || {};
945
945
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
946
946
  let imageEnableResult = true;
947
947
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
948
948
  if (
949
949
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
950
950
  ) {
951
951
  imageEnableResult = false;
952
952
  } else if (
953
953
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
954
954
  ) {
955
955
  isIgnoreOptimizeFromServer = true;
956
956
  imageEnableResult = true;
957
957
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
958
958
  isIgnoreOptimizeFromServer = true;
959
959
  imageEnableResult = true;
960
960
  } else {
961
961
  imageEnableResult = globalOn === true || page[buildType] === true;
962
962
  if (globalOn === true) {
963
963
  isIgnoreOptimizeFromServer = true;
964
964
  } else if (page[buildType] === true) {
965
965
  } else {
966
966
  }
967
967
  }
968
968
  result = imageEnableResult;
969
969
  return imageEnableResult;
970
970
  } else {
971
971
  result = false;
972
972
  return false;
973
973
  }
974
974
  } else {
975
975
  return result;
976
976
  }
977
977
  };
978
978
  if (typeof options === 'object' && isImageOptimizeEnable()) {
979
979
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
980
980
  } else {
981
981
  return getQualityImageOld(imgUrl, options);
982
982
  }
983
983
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
984
984
  windowWidth: window.innerWidth,
985
985
  containerWidth: getContainerWidth(buildType, {
986
986
  windowWidth: window.innerWidth,
987
987
  }),
988
988
  screenWidth: window.innerWidth,
989
989
  platform: '',
990
990
  model: '',
991
991
  system: '',
992
992
  };
993
993
  return getSystemInfo;
994
994
  const params = Object.assign(
995
995
  {},
996
996
  {
997
997
  title: '',
998
998
  duration: 1500,
999
999
  },
1000
1000
  options,
1001
1001
  );
1002
1002
  params.duration = params.duration / 1000;
1003
1003
  if (isJdApp && !isJdAppForNotMain && !isJdAndHarmonyDevice && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
1004
1004
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
1005
1005
  const duration = isAndroidDevice ? 0 : params.duration;
1006
1006
  nativePageShowToast(options.title, showSuccessType, duration);
1007
1007
  console.log('执行原生toast success');
1008
1008
  } else {
1009
1009
  showSuccessToast(options);
1010
1010
  }
1011
1011
  const params = Object.assign(
1012
1012
  {},
1013
1013
  {
1014
1014
  title: '',
1015
1015
  duration: 1500,
1016
1016
  },
1017
1017
  options,
1018
1018
  );
1019
1019
  params.duration = params.duration / 1000;
1020
1020
  if (isJdApp && !isJdAppForNotMain && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
1021
1021
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
1022
1022
  const duration = isAndroidDevice ? 0 : params.duration;
1023
1023
  nativePageShowToast(options.title, showSuccessType, duration);
1024
1024
  console.log('执行原生toast fail');
1025
1025
  } else {
1026
1026
  console.log('执行H5 toast fail');
1027
1027
  showFailToast(options);
1028
1028
  }
1029
1029
  const params = Object.assign(
1030
1030
  {},
1031
1031
  {
1032
1032
  title: '',
1033
1033
  duration: 1500,
1034
1034
  },
1035
1035
  options,
1036
1036
  );
1037
1037
  params.duration = params.duration / 1000;
1038
1038
  if (isJdApp && !isJdAppForNotMain && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
1039
1039
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
1040
1040
  const duration = isAndroidDevice ? 0 : params.duration;
1041
1041
  nativePageShowToast(options.title, showSuccessType, duration);
1042
1042
  } else {
1043
1043
  showNormalToast(options);
1044
1044
  }
1045
1045
  if (isLanguageForEn) {
1046
1046
  count = Number(count);
1047
1047
  if (count >= 1000000000) {
1048
1048
  return (count / 1000000000).toFixed(fixedNum) + 'B';
1049
1049
  } else if (count >= 1000000) {
1050
1050
  return (count / 1000000).toFixed(fixedNum) + 'M';
1051
1051
  } else if (count >= 1000) {
1052
1052
  return (count / 1000).toFixed(fixedNum) + 'K';
1053
1053
  } else {
1054
1054
  return count;
1055
1055
  }
1056
1056
  } else {
1057
1057
  return h5CountStringify(count, fixedNum, unit, maxNum);
1058
1058
  }
1059
1059
  const createLoadingEle = document.createElement('div');
1060
1060
  createLoadingEle.id = 'J_shopLoading';
1061
1061
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
1062
1062
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
1063
1063
  <span class='d-shop-loading-icon'></span>
1064
1064
  <p class='d-shop-text'>${text}</p>
1065
1065
  </div>`;
1066
1066
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
1067
1067
  getEle.appendChild(createLoadingEle);
1068
1068
  const getEle = document.getElementById('J_shopLoading');
1069
1069
  getEle && getEle.remove();
1070
1070
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
1071
1071
  if (!systemInfo.system && window) {
1072
1072
  systemInfo.system = window.navigator.userAgent;
1073
1073
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
1074
1074
  }
1075
1075
  const isIOS = !!systemInfo?.system.match(/ios/i);
1076
1076
  const isAndroid = !!systemInfo?.system.match(/android/i);
1077
1077
  systemInfo.navBarHeight = 0;
1078
1078
  systemInfo.statusBarHeight = 0;
1079
1079
  systemInfo.capsulePosition = null;
1080
1080
  systemInfo.isIOS = isIOS;
1081
1081
  systemInfo.isAndroid = isAndroid;
1082
1082
  _ShopSystemInfo = systemInfo;
1083
1083
  return systemInfo;
1084
1084
  const result = originDealShopContentData(pageData, draBusinessCustomReport, isvdev);
1085
1085
  if (isJdAndHarmonyDevice && isNewHarmonyShop) {
1086
1086
  result.shopContentContainerListData = result.shopContentContainerListData.filter(
1087
1087
  (item) =>
1088
1088
  item.floors.length > 0 &&
1089
1089
  !isInHarmonyBlacklistByModuleFlag(item.containerId, result.shopContentContainerListData),
1090
1090
  );
1091
1091
  }
1092
1092
  return result;
1093
1093
  const numScale = Number(scale);
1094
1094
  if (isNaN(numScale)) {
1095
1095
  console.warn(
1096
1096
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
1097
1097
  );
1098
1098
  return false;
1099
1099
  }
1100
1100
  const { venderId } = global.info.queryInfo || {};
1101
1101
  const id = venderId;
1102
1102
  if (!id && numScale !== 1) {
1103
1103
  return false;
1104
1104
  }
1105
1105
  const useScale = Math.max(0, Math.min(1, numScale));
1106
1106
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
1107
1107
  if (reportKey) {
1108
1108
  console.log(
1109
1109
  `基于KEY[${reportKey}]的灰度调用1次~`,
1110
1110
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
1111
1111
  );
1112
1112
  if (isMatch) {
1113
1113
  console.log(
1114
1114
  `基于KEY[${reportKey}]的命中1次灰度!`,
1115
1115
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
1116
1116
  );
1117
1117
  }
1118
1118
  }
1119
1119
  return isMatch;
1120
1120
  isJdApp,
1121
1121
  isWxApp,
1122
1122
  isIosDevice,
1123
1123
  isAndroidDevice,
1124
1124
  isHarmonyDevice,
1125
1125
  isJdAndIosDevice,
1126
1126
  isJdAndAndroidDevice,
1127
1127
  isJdAndHarmonyDevice,
1128
1128
  isNewHarmonyShop,
1129
1129
  isJdAndroidX5Core,
1130
1130
  isMin,
1131
1131
  isWxMin,
1132
1132
  isWxMinAndWxapp,
1133
1133
  isJdMinAndHarmony,
1134
1134
  isJdMin,
1135
1135
  isH5,
1136
1136
  isH5AndJdShopView,
1137
1137
  isChartH5,
1138
1138
  isH5AndJdShopViewNativeScroll,
1139
1139
  isH5AndJdShopViewH5Scroll,
1140
1140
  isH5AndJdShopH5CustomScrollView,
1141
1141
  isH5AndJingGouMini,
1142
1142
  isWxMiniH5View,
1143
1143
  urlCookie,
1144
1144
  sliceArrToChunkList,
1145
1145
  dealAddress,
1146
1146
  objectToUrlEncode,
1147
1147
  parseQueryUrlString,
1148
1148
  setLowSmallPicUrl,
1149
1149
  setTaroStorage,
1150
1150
  getTaroStorageKeyValue,
1151
1151
  removeTaroStorageKey,
1152
1152
  clearTaroStorageKey,
1153
1153
  getAvifSupport,
1154
1154
  getWebpSupport,
1155
1155
  getQualityImage,
1156
1156
  formatCountForUnit as countStringify,
1157
1157
  getWxAppCookieStr,
1158
1158
  getSystemInfos,
1159
1159
  pxTransformFromData,
1160
1160
  dealShopContentDataAndReport as dealShopContentData,
1161
1161
  dateFormat,
1162
1162
  throttle,
1163
1163
  lodashThrottle,
1164
1164
  debounce,
1165
1165
  addHttps,
1166
1166
  commonShowSuccessToast as showSuccessToast,
1167
1167
  commonShowFailToast as showFailToast,
1168
1168
  commonShowNormalToast as showNormalToast,
1169
1169
  showShopLoading,
1170
1170
  hideShopLoading,
1171
1171
  stopNativeScrollEvent,
1172
1172
  getAppChannelType,
1173
1173
  formatTabActiveMenuType,
1174
1174
  filterUrlQueryData,
1175
1175
  draCustomReport,
1176
1176
  remoteCustomReport,
1177
1177
  draInterfaceCustomReport,
1178
1178
  draBusinessCustomReport,
1179
1179
  draBusinessCustomLogReport,
1180
1180
  isMemberPage,
1181
1181
  getFloorDataToDataDefines,
1182
1182
  isOpenJdAppUrl,
1183
1183
  jdOpenAppParams,
1184
1184
  createJdOpenAppUrl,
1185
1185
  isEmpty,
1186
1186
  getJdAppReportPageSource,
1187
1187
  isAppClassifyPage,
1188
1188
  isAppHomeForMarketPage,
1189
1189
  isImageOptimizeEnable,
1190
1190
  isPc,
1191
1191
  isPcClassifyPage,
1192
1192
  ipLoc_djd,
1193
1193
  isTjScence,
1194
1194
  isH5AdnJxMini,
1195
1195
  isTjM,
1196
1196
  isTjJxM,
1197
1197
  isTJApp,
1198
1198
  isH5AdnHaoWuJie,
1199
1199
  tjChannel,
1200
1200
  dealJdOpenAppData,
1201
1201
  jdAppVersionCompare,
1202
1202
  dealNativePixelToCssPixel,
1203
1203
  isAppStowShop,
1204
1204
  getSgmCustomCode,
1205
1205
  handleSgmCodeTaroVersion,
1206
1206
  isInGrayscale,
1207
1207
  isIpadDevice,
1208
1208
  getBorderStyle,
1209
1209
  isSupportHybridHttpRequest,
1210
1210
  isLanguageForEn,
1211
1211
  sColor,
1212
1212
  isTabletDevice,
1213
1213
  taroToTransformRoutimePXNumber,
1214
1214
  updateContainerWidth,
1215
1215
  isInJdShopView,
1216
1216
  isDongWebView,
1217
1217
  isLanguageForHk,
1218
1218
  languageNowType,
1219
1219
  isInJdAppH5DebugMode,
1220
1220
  isJdLiteApp,
1221
1221
  isJdAppForNotMain,