@conecli/cone-render 0.10.1-shop-beta.63 → 0.10.1-shop-beta.65

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