@conecli/cone-render 0.10.1-shop-beta.9 → 0.10.1-shop-beta.10

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