@conecli/cone-render 0.10.1-shop3.17 → 0.10.1-shop3.18

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