@conecli/cone-render 0.10.1-shop3.95 → 0.10.1-shop3.96

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