@conecli/cone-render 0.10.1-shop3.134 → 0.10.1-shop3.136

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