@conecli/cone-render 0.10.1-shop-beta.57 → 0.10.1-shop-beta.58

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