@conecli/cone-render 0.10.1-shop3.139 → 0.10.1-shop3.140

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