@conecli/cone-render 0.10.1-shop-beta.22 → 0.10.1-shop-beta.24

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