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

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