@conecli/cone-render 0.10.1-shop-beta.35 → 0.10.1-shop-beta.36

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