@conecli/cone-render 0.10.1-shop3.112 → 0.10.1-shop3.113

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