@conecli/cone-render 0.10.1-shop3.21 → 0.10.1-shop3.22

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