@conecli/cone-render 0.10.1-shop3.5 → 0.10.1-shop3.50

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