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

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