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