@conecli/cone-render 0.10.1-shop3.125 → 0.10.1-shop3.126

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