@conecli/cone-render 0.10.1-shop-beta.23 → 0.10.1-shop-beta.26

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 (128) 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/index.h5.ts +1 -1
  13. package/dist/common/token/token.jd.ts +1 -1
  14. package/dist/common/wxappApi.ascf.ts +1 -0
  15. package/dist/components/ErrorBoundary.tsx +1 -1
  16. package/dist/components/base/CountDown/index.tsx +1 -1
  17. package/dist/components/base/CustomVideo/index.tsx +1 -1
  18. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  19. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  21. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  22. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  23. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  24. package/dist/components/base/JdLoading/index.module.scss +0 -2
  25. package/dist/components/base/JdLoading/index.tsx +1 -1
  26. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  27. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  28. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  30. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  31. package/dist/components/base/NetworkDataError/const.ts +1 -1
  32. package/dist/components/base/NetworkDataError/index.module.scss +1 -1
  33. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  34. package/dist/components/base/Price/Base/index.tsx +1 -1
  35. package/dist/components/base/Price/Double/index.module.scss +1 -1
  36. package/dist/components/base/Price/Double/index.tsx +1 -1
  37. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  38. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  39. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  40. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  41. package/dist/components/floorItem.tsx +1 -1
  42. package/dist/components/isv/Floor/index.tsx +1 -1
  43. package/dist/components/remoteFloorItem.tsx +1 -1
  44. package/dist/config/env.ts +1 -1
  45. package/dist/interface/common.ts +1 -1
  46. package/dist/interface/component.ts +1 -1
  47. package/dist/interface/jumpEventReport.ts +1 -1
  48. package/dist/interface/service.ts +1 -1
  49. package/dist/jumpEventReport/base.ts +1 -1
  50. package/dist/jumpEventReport/const.ts +1 -1
  51. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  52. package/dist/jumpEventReport/index.h5.ts +1 -1
  53. package/dist/jumpEventReport/index.ts +1 -1
  54. package/dist/jumpEventReport/index.weapp.ts +1 -1
  55. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  56. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  57. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  58. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  59. package/dist/jumpEventReport/web/report.ts +1 -1
  60. package/dist/jumpEventReport/web.base.ts +1 -1
  61. package/dist/jumpEventReport/web.jd.ts +1 -1
  62. package/dist/jumpEventReport/web.pc.ts +1 -1
  63. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  64. package/dist/language/en_US.json +233 -83
  65. package/dist/language/zh_CN.json +232 -82
  66. package/dist/language/zh_HK.json +232 -82
  67. package/dist/libs/openShopBridge.js +161 -0
  68. package/dist/libs/openShopBridge.min.js +1 -0
  69. package/dist/libs/taroAppReport.js +2 -2
  70. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  71. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  72. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  73. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  74. package/dist/open/api/index.ts +1 -1
  75. package/dist/open/api/shopMember.ts +1 -1
  76. package/dist/open/api/shopMember.weapp.ts +1 -0
  77. package/dist/open/api/track.ts +1 -1
  78. package/dist/open/api/util.ts +1 -1
  79. package/dist/open/components/index.ts +1 -1
  80. package/dist/open/index.ts +1 -1
  81. package/dist/sass/app.h5.scss +6 -1
  82. package/dist/sass/base.scss +8 -4
  83. package/dist/service/fetchGateway.ts +1 -1
  84. package/dist/service/fetchGateway.weapp.ts +1 -1
  85. package/dist/service/fetchJsonp.ts +1 -1
  86. package/dist/service/fetchJsonp.weapp.ts +1 -0
  87. package/dist/service/http/h5Http.ts +1 -1
  88. package/dist/service/http/http.ts +1 -1
  89. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  90. package/dist/service/requestServer.h5.ts +1 -1
  91. package/dist/service/requestServer.ts +1 -1
  92. package/dist/service/requestServer.weapp.ts +1 -1
  93. package/dist/utils/connectNativeJsBridge.ts +1 -1
  94. package/dist/utils/h5Utils.ts +1 -1
  95. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  96. package/dist/utils/harmonyCallRouter.ts +0 -0
  97. package/dist/utils/index.h5.ts +1 -1
  98. package/dist/utils/index.ts +1 -1
  99. package/dist/utils/index.weapp.ts +1 -1
  100. package/dist/utils/intersectionObserver.ts +1 -1
  101. package/dist/utils/sColor.weapp.ts +1 -0
  102. package/dist/utils/utils.ts +1 -1
  103. package/package.json +36 -38
  104. package/dist/common/index.dynamic.ts +0 -1
  105. package/dist/components/base/Dialog/index.dynamic.module.scss +0 -126
  106. package/dist/components/base/Dialog/index.dynamic.tsx +0 -1
  107. package/dist/components/base/DynamicTest/index.dynamic.module.scss +0 -15
  108. package/dist/components/base/DynamicTest/index.module.scss +0 -16
  109. package/dist/components/base/DynamicTest/index.tsx +0 -1
  110. package/dist/components/base/LazyLoadImage/index.dynamic.module.scss +0 -40
  111. package/dist/components/base/LazyLoadImage/index.dynamic.tsx +0 -1
  112. package/dist/components/base/NetworkDataError/index.dynamic.module.scss +0 -95
  113. package/dist/components/base/NetworkDataError/index.dynamic.tsx +0 -1
  114. package/dist/components/base/Price/Base/index.dynamic.module.scss +0 -63
  115. package/dist/components/base/Price/Base/index.dynamic.tsx +0 -1
  116. package/dist/components/base/Price/Double/index.dynamic.module.scss +0 -172
  117. package/dist/components/base/Price/Double/index.dynamic.tsx +0 -1
  118. package/dist/jumpEventReport/index.dynamic.ts +0 -1
  119. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  120. package/dist/open/api/shopMember.dynamic.ts +0 -1
  121. package/dist/open/components/index.dynamic.ts +0 -1
  122. package/dist/sass/app.dynamic.scss +0 -306
  123. package/dist/service/fetchGateway.h5.ts +0 -1
  124. package/dist/service/fetchJsonp.h5.ts +0 -1
  125. package/dist/service/http/colorSign.dynamic.ts +0 -1
  126. package/dist/utils/connectNativeJsBridge.dynamic.ts +0 -1
  127. package/dist/utils/priceUtils.js +0 -1
  128. /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
  isAscfApp,
691
691
  isInJdAppH5DebugMode,
692
692
  isJdLiteApp,
693
693
  isJdAppForNotMain,
694
694
  addHttps,
695
695
  clearTaroStorageKey,
696
696
  countStringify as h5CountStringify,
697
697
  dateFormat,
698
698
  dealAddress,
699
699
  dealShopContentData as originDealShopContentData,
700
700
  debounce,
701
701
  filterUrlQueryData,
702
702
  formatTabActiveMenuType,
703
703
  getAvifSupport,
704
704
  getWebpSupport,
705
705
  getTaroStorageKeyValue,
706
706
  getWxAppCookieStr,
707
707
  isH5,
708
708
  isMin,
709
709
  isJdMin,
710
710
  isWxMin,
711
711
  isWxMinAndWxapp,
712
712
  isJdMinAndHarmony,
713
713
  lodashThrottle,
714
714
  objectToUrlEncode,
715
715
  parseQueryUrlString,
716
716
  removeTaroStorageKey,
717
717
  setLowSmallPicUrl,
718
718
  setTaroStorage,
719
719
  showFailToast,
720
720
  showNormalToast,
721
721
  showSuccessToast,
722
722
  sliceArrToChunkList,
723
723
  throttle,
724
724
  getQualityImageNew,
725
725
  getQualityImageOld,
726
726
  isOpenJdAppUrl,
727
727
  jdOpenAppParams,
728
728
  createJdOpenAppUrl,
729
729
  isEmpty,
730
730
  getJdAppReportPageSource,
731
731
  dealJdOpenAppData,
732
732
  getBorderStyle,
733
733
  isInHarmonyBlacklistByModuleFlag,
734
734
  const getNum = Number(num);
735
735
  let _changeLayoutWidth = layoutWidth;
736
736
  if (!_changeLayoutWidth) {
737
737
  _changeLayoutWidth =
738
738
  _ShopSystemInfo && _ShopSystemInfo?.windowWidth
739
739
  ? _ShopSystemInfo.windowWidth
740
740
  : Taro.getSystemInfoSync()?.windowWidth;
741
741
  }
742
742
  return _ShopSystemInfo?.isJdTabletDevice && !layoutWidth
743
743
  ? Math.floor(getNum * 1.2 * (_changeLayoutWidth / 720))
744
744
  : Math.round((getNum / widthSize) * _changeLayoutWidth);
745
745
  const getRootFontSize = (40 * (systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth)) / 750;
746
746
  let getRealRootFontSize = getRootFontSize > 40 ? 40 : getRootFontSize < 20 ? 20 : getRootFontSize;
747
747
  if (_ShopSystemInfo?.isJdTabletDevice) {
748
748
  getRealRootFontSize = Math.floor(
749
749
  24 * ((systemInfo?.windowWidth ?? _ShopSystemInfo.windowWidth) / 720),
750
750
  );
751
751
  }
752
752
  return Math.ceil(
753
753
  (((parseInt(String(changeSize), 10) / 40) * 750) / designWidth) * getRealRootFontSize,
754
754
  );
755
755
  console.log(
756
756
  '获取系统宽度systemInfo?.windowWidth',
757
757
  systemInfo?.windowWidth,
758
758
  'taroToTransformRoutimePXNumber(changeWidth)',
759
759
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
760
760
  );
761
761
  return buildType === BUILD_TYPE.CLASSIFY && systemInfo?.windowWidth
762
762
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
763
763
  : (systemInfo?.windowWidth ?? 0);
764
764
  const systemInfo = _ShopSystemInfo || Taro.getSystemInfoSync();
765
765
  console.log(
766
766
  '获取系统宽度systemInfo?.windowWidth',
767
767
  systemInfo?.windowWidth,
768
768
  'taroToTransformRoutimePXNumber(changeWidth)',
769
769
  taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo),
770
770
  );
771
771
  const containerWidth =
772
772
  isClassify && systemInfo?.windowWidth
773
773
  ? systemInfo?.windowWidth - taroToTransformRoutimePXNumber(changeWidth, 750, systemInfo)
774
774
  : (systemInfo?.windowWidth ?? 0);
775
775
  if (global?.info?.sysInfo) {
776
776
  global.info.sysInfo['containerWidth'] = containerWidth;
777
777
  }
778
778
  return (
779
779
  isJdApp &&
780
780
  (parseQueryUrlObj['device'] === 'tablet' || Math.min(rootEleWidth, window.screen.height) >= 720)
781
781
  );
782
782
  const systemInfo = Taro.getSystemInfoSync();
783
783
  if (params && params?.pageWidth && params?.pageHeight) {
784
784
  systemInfo.windowWidth = params?.pageWidth;
785
785
  systemInfo.windowHeight = params?.pageHeight;
786
786
  console.warn('松果app内获取重置系统信息宽度值', params, ',systemInfo信息集合为', systemInfo);
787
787
  } else {
788
788
  if (isPc) {
789
789
  systemInfo.windowWidth = 375;
790
790
  } else {
791
791
  const getWinWidth = window.innerWidth;
792
792
  const getWinHeight = window.innerHeight;
793
793
  const getScreenWidth = window.screen.width;
794
794
  const getScreenHeight = window.screen.height;
795
795
  const getRootEleInitWidth = params?.rootEleInitWidth || 0;
796
796
  const isReplaceSystemWidth = params?.replaceSystemWidth || false;
797
797
  systemInfo.isJdTabletDevice = checkIsJdTabletDevice(getRootEleInitWidth);
798
798
  systemInfo.isJdTabletLandscape =
799
799
  systemInfo.isJdTabletDevice &&
800
800
  checkPadScreenOrientationIsLandscape(getRootEleInitWidth, getScreenWidth, getScreenHeight);
801
801
  if (!systemInfo.isJdTabletDevice && isReplaceSystemWidth) {
802
802
  if (systemInfo?.windowWidth <= 0) {
803
803
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth);
804
804
  systemInfo.windowHeight = getScreenHeight;
805
805
  console.warn(
806
806
  '====初始化获取当前设备不是pad,但是触发屏幕宽高最小值600,系统获取宽度为0,进行重置系统宽度为根元素宽度与屏幕宽度最小值====',
807
807
  systemInfo.windowWidth,
808
808
  'getRootEleInitWidth',
809
809
  getRootEleInitWidth,
810
810
  'getScreenWidth',
811
811
  getScreenWidth,
812
812
  'getScreenHeight',
813
813
  getScreenHeight,
814
814
  );
815
815
  draBusinessCustomReport({
816
816
  eventName: 'business',
817
817
  errorName: 'jdapp_pad_width_error_info',
818
818
  errorMessage: `松果app内获取当前设备不是pad,触发屏幕宽高最小值600,系统信息宽度为0,进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
819
819
  extraData: JSON.stringify({
820
820
  isJdApp,
821
821
  isAndroidDevice,
822
822
  getScreenWidth,
823
823
  getScreenHeight,
824
824
  getWinWidth,
825
825
  getWinHeight,
826
826
  getRootEleInitWidth,
827
827
  }),
828
828
  });
829
829
  }
830
830
  } else {
831
831
  if (isJdApp && isAndroidDevice && !systemInfo.isJdTabletDevice && systemInfo) {
832
832
  const isLandscape = getScreenWidth >= getScreenHeight;
833
833
  const { windowWidth, windowHeight, screenWidth, screenHeight } = systemInfo;
834
834
  if (windowWidth <= 0) {
835
835
  systemInfo.initWindowWidth = windowWidth;
836
836
  if (isLandscape) {
837
837
  systemInfo.windowWidth = getScreenHeight;
838
838
  systemInfo.windowHeight = getScreenWidth;
839
839
  systemInfo.screenWidth = getScreenHeight;
840
840
  systemInfo.screenHeight = getScreenWidth;
841
841
  } else {
842
842
  systemInfo.windowWidth = getScreenWidth;
843
843
  systemInfo.windowHeight = getScreenHeight;
844
844
  systemInfo.screenWidth = getScreenWidth;
845
845
  systemInfo.screenHeight = getScreenHeight;
846
846
  }
847
847
  console.warn(
848
848
  `松果安卓app内获取系统信息宽度异常为小于等于0,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取窗口高度值${windowHeight},重置后的高度值${systemInfo.windowHeight},根元素宽度值${getRootEleInitWidth}`,
849
849
  );
850
850
  draBusinessCustomReport({
851
851
  eventName: 'UIInteract',
852
852
  errorName: 'android_jdapp_width_error_info',
853
853
  errorMessage: `松果安卓app内获取系统信息宽度为小于等于0,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
854
854
  extraData: JSON.stringify({
855
855
  isJdApp,
856
856
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
857
857
  getScreenWidth,
858
858
  getScreenHeight,
859
859
  getWinWidth,
860
860
  getWinHeight,
861
861
  getRootEleInitWidth,
862
862
  }),
863
863
  });
864
864
  } else {
865
865
  let _getChangeWinWidthState = false;
866
866
  if (getWinWidth > 0 && windowWidth > 0 && windowWidth > getWinWidth) {
867
867
  if (isLandscape) {
868
868
  systemInfo.windowWidth = getScreenHeight;
869
869
  systemInfo.windowHeight = getScreenWidth;
870
870
  systemInfo.screenWidth = getScreenHeight;
871
871
  systemInfo.screenHeight = getScreenWidth;
872
872
  } else {
873
873
  systemInfo.windowWidth = getScreenWidth;
874
874
  systemInfo.windowHeight = getScreenHeight;
875
875
  systemInfo.screenWidth = getScreenWidth;
876
876
  systemInfo.screenHeight = getScreenHeight;
877
877
  }
878
878
  _getChangeWinWidthState = true;
879
879
  }
880
880
  _getChangeWinWidthState &&
881
881
  console.warn(
882
882
  `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,taro获取窗口宽度值${windowWidth},重置后的宽度值${systemInfo.windowWidth},taro获取屏幕宽度值${screenWidth},重置后的宽度值${systemInfo.screenWidth}`,
883
883
  );
884
884
  if (_getChangeWinWidthState) {
885
885
  draBusinessCustomReport({
886
886
  eventName: 'business',
887
887
  errorName: 'android_jdapp_width_error_info_2',
888
888
  errorMessage: `松果安卓app内获取系统信息宽度异常,是否为横屏${isLandscape},进行重置,通过window获取的结果,getWinWidth:${getWinWidth},getScreenWidth: ${getScreenWidth},getWinHeight:${getWinHeight},getScreenHeight: ${getScreenHeight},根元素宽度值:${getRootEleInitWidth}`,
889
889
  extraData: JSON.stringify({
890
890
  isJdApp,
891
891
  initData: `Taro.getSystemInfo获取窗口宽度值${windowWidth},高度值${windowHeight},获取屏幕宽度值${screenWidth},高度值${screenHeight}`,
892
892
  getScreenWidth,
893
893
  getScreenHeight,
894
894
  getWinWidth,
895
895
  getWinHeight,
896
896
  getRootEleInitWidth,
897
897
  }),
898
898
  });
899
899
  }
900
900
  }
901
901
  }
902
902
  }
903
903
 
904
904
  if (systemInfo.isJdTabletDevice) {
905
905
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
906
906
  systemInfo.windowHeight = Math.max(getScreenWidth, getScreenHeight);
907
907
  if (systemInfo.isJdTabletLandscape) {
908
908
  const getRenderCenterState = window?.PAGE_DATA?.businessData?.fitPadCenterRenderLowVersion
909
909
  ? jdAppVersionCompare(window.PAGE_DATA.businessData.fitPadCenterRenderLowVersion) < 0
910
910
  : false;
911
911
  if (getRenderCenterState && window?.PAGE_DATA) {
912
912
  window.PAGE_DATA.isFitJdPadRenderCenter = true;
913
913
  }
914
914
  if (window?.PAGE_DATA?.isFitJdPadRenderCenter) {
915
915
  systemInfo.windowWidth = Math.min(getRootEleInitWidth, getScreenWidth, getScreenHeight);
916
916
  systemInfo.windowHeight = Math.max(
917
917
  getRootEleInitWidth,
918
918
  getScreenWidth,
919
919
  getScreenHeight,
920
920
  );
921
921
  } else {
922
922
  systemInfo.windowWidth = Math.max(getRootEleInitWidth, getScreenWidth, getScreenHeight);
923
923
  systemInfo.windowHeight = Math.min(
924
924
  getRootEleInitWidth,
925
925
  getScreenWidth,
926
926
  getScreenHeight,
927
927
  );
928
928
  }
929
929
  }
930
930
  console.warn(
931
931
  '====初始化获取当前设备是否是平板设备,是否横屏====',
932
932
  systemInfo.isJdTabletDevice,
933
933
  systemInfo.isJdTabletLandscape,
934
934
  '屏幕信息',
935
935
  window.screen,
936
936
  'getScreenWidth',
937
937
  getScreenWidth,
938
938
  'getScreenHeight',
939
939
  getScreenHeight,
940
940
  'getRootEleInitWidth',
941
941
  getRootEleInitWidth,
942
942
  '当前是否要求居中展示,居中展示那么宽高值要对调',
943
943
  window?.PAGE_DATA?.isFitJdPadRenderCenter,
944
944
  '当前pad最终展示的窗口宽度',
945
945
  systemInfo.windowWidth,
946
946
  );
947
947
  }
948
948
  }
949
949
  }
950
950
  systemInfo['containerWidth'] = getContainerWidth(buildType, systemInfo);
951
951
  console.warn('====获取系统信息=====', systemInfo);
952
952
  return systemInfo;
953
953
  let result: boolean | null = null;
954
954
  return function () {
955
955
  if (result === null) {
956
956
  const appVersionCheckPass = jdAppVersionCompare(MPAAS_CONFIG_APP_VERSION) >= 0;
957
957
  if (!isJdApp) {
958
958
  console.warn('🚗 ~~ file: utils.ts:191 站外H5默认打开图片优化~');
959
959
  isIgnoreOptimizeFromServer = true;
960
960
  result = true;
961
961
  return true;
962
962
  }
963
963
  const enableAvifOptimize = appVersionCheckPass;
964
964
  if (enableAvifOptimize) {
965
965
  const configData = global?.getDynamicConfig('avifSwitch');
966
966
  const {
967
967
  globalOn = true,
968
968
  ignoreOptimizeFromServer = false,
969
969
  page = {},
970
970
  grayscale = {},
971
971
  whiteList = [],
972
972
  blackList = [],
973
973
  } = configData || {};
974
974
  const { shopId = '0', venderId = '0' } = parseQueryUrlObj;
975
975
  let imageEnableResult = true;
976
976
  isIgnoreOptimizeFromServer = ignoreOptimizeFromServer;
977
977
  if (
978
978
  blackList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
979
979
  ) {
980
980
  imageEnableResult = false;
981
981
  } else if (
982
982
  whiteList.find((item) => item.sId === Number(shopId) || item.vId === Number(venderId))
983
983
  ) {
984
984
  isIgnoreOptimizeFromServer = true;
985
985
  imageEnableResult = true;
986
986
  } else if (grayscale[buildType] && isInGrayscale(grayscale[buildType])) {
987
987
  isIgnoreOptimizeFromServer = true;
988
988
  imageEnableResult = true;
989
989
  } else {
990
990
  imageEnableResult = globalOn === true || page[buildType] === true;
991
991
  if (globalOn === true) {
992
992
  isIgnoreOptimizeFromServer = true;
993
993
  } else if (page[buildType] === true) {
994
994
  } else {
995
995
  }
996
996
  }
997
997
  result = imageEnableResult;
998
998
  return imageEnableResult;
999
999
  } else {
1000
1000
  result = false;
1001
1001
  return false;
1002
1002
  }
1003
1003
  } else {
1004
1004
  return result;
1005
1005
  }
1006
1006
  };
1007
1007
  if (typeof options === 'object' && isImageOptimizeEnable()) {
1008
1008
  return getQualityImageNew(imgUrl, options, isIgnoreOptimizeFromServer);
1009
1009
  } else {
1010
1010
  return getQualityImageOld(imgUrl, options);
1011
1011
  }
1012
1012
  const getSystemInfo = getSystemAndContainerWidthInfo(params) || {
1013
1013
  windowWidth: window.innerWidth,
1014
1014
  containerWidth: getContainerWidth(buildType, {
1015
1015
  windowWidth: window.innerWidth,
1016
1016
  }),
1017
1017
  screenWidth: window.innerWidth,
1018
1018
  platform: '',
1019
1019
  model: '',
1020
1020
  system: '',
1021
1021
  };
1022
1022
  return getSystemInfo;
1023
1023
  const params = Object.assign(
1024
1024
  {},
1025
1025
  {
1026
1026
  title: '',
1027
1027
  duration: 1500,
1028
1028
  },
1029
1029
  options,
1030
1030
  );
1031
1031
  params.duration = params.duration / 1000;
1032
1032
  if (
1033
1033
  isJdApp &&
1034
1034
  !isJdAppForNotMain &&
1035
1035
  !isJdAndHarmonyDevice &&
1036
1036
  !window?.PAGE_DATA?.businessData?.hideNativeToast
1037
1037
  ) {
1038
1038
  const showSuccessType = isIosDevice ? ToastIosType.SUCCESS : ToastAndroidType.SUCCESS;
1039
1039
  const duration = isAndroidDevice ? 0 : params.duration;
1040
1040
  nativePageShowToast(options.title, showSuccessType, duration);
1041
1041
  console.log('执行原生toast success');
1042
1042
  } else {
1043
1043
  showSuccessToast(options);
1044
1044
  }
1045
1045
  const params = Object.assign(
1046
1046
  {},
1047
1047
  {
1048
1048
  title: '',
1049
1049
  duration: 1500,
1050
1050
  },
1051
1051
  options,
1052
1052
  );
1053
1053
  params.duration = params.duration / 1000;
1054
1054
  if (isJdApp && !isJdAppForNotMain && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
1055
1055
  const showSuccessType = isIosDevice ? ToastIosType.FAIL : ToastAndroidType.FAIL;
1056
1056
  const duration = isAndroidDevice ? 0 : params.duration;
1057
1057
  nativePageShowToast(options.title, showSuccessType, duration);
1058
1058
  console.log('执行原生toast fail');
1059
1059
  } else {
1060
1060
  console.log('执行H5 toast fail');
1061
1061
  showFailToast(options);
1062
1062
  }
1063
1063
  const params = Object.assign(
1064
1064
  {},
1065
1065
  {
1066
1066
  title: '',
1067
1067
  duration: 1500,
1068
1068
  },
1069
1069
  options,
1070
1070
  );
1071
1071
  params.duration = params.duration / 1000;
1072
1072
  if (isJdApp && !isJdAppForNotMain && !window?.PAGE_DATA?.businessData?.hideNativeToast) {
1073
1073
  const showSuccessType = isIosDevice ? ToastIosType.NORMAL : ToastAndroidType.NORMAL;
1074
1074
  const duration = isAndroidDevice ? 0 : params.duration;
1075
1075
  nativePageShowToast(options.title, showSuccessType, duration);
1076
1076
  } else {
1077
1077
  showNormalToast(options);
1078
1078
  }
1079
1079
  if (isLanguageForEn) {
1080
1080
  count = Number(count);
1081
1081
  if (count >= 1000000000) {
1082
1082
  return (count / 1000000000).toFixed(fixedNum) + 'B';
1083
1083
  } else if (count >= 1000000) {
1084
1084
  return (count / 1000000).toFixed(fixedNum) + 'M';
1085
1085
  } else if (count >= 1000) {
1086
1086
  return (count / 1000).toFixed(fixedNum) + 'K';
1087
1087
  } else {
1088
1088
  return count;
1089
1089
  }
1090
1090
  } else {
1091
1091
  return h5CountStringify(count, fixedNum, unit, maxNum);
1092
1092
  }
1093
1093
  const createLoadingEle = document.createElement('div');
1094
1094
  createLoadingEle.id = 'J_shopLoading';
1095
1095
  createLoadingEle.className = `d-shop-loading flexible-center-box ${customClassName}`;
1096
1096
  createLoadingEle.innerHTML = `<div class='d-loading-content'>
1097
1097
  <span class='d-shop-loading-icon'></span>
1098
1098
  <p class='d-shop-text'>${text}</p>
1099
1099
  </div>`;
1100
1100
  const getEle = document.body ? document.body : document.getElementsByTagName('body')[0];
1101
1101
  getEle.appendChild(createLoadingEle);
1102
1102
  const getEle = document.getElementById('J_shopLoading');
1103
1103
  getEle && getEle.remove();
1104
1104
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getReviseSystemInfo(params);
1105
1105
  if (!systemInfo.system && window) {
1106
1106
  systemInfo.system = window.navigator.userAgent;
1107
1107
  systemInfo.isChrome = !!systemInfo?.system.match(/chrome/i);
1108
1108
  }
1109
1109
  const isIOS = !!systemInfo?.system.match(/ios/i);
1110
1110
  const isAndroid = !!systemInfo?.system.match(/android/i);
1111
1111
  systemInfo.navBarHeight = 0;
1112
1112
  systemInfo.statusBarHeight = 0;
1113
1113
  systemInfo.capsulePosition = null;
1114
1114
  systemInfo.isIOS = isIOS;
1115
1115
  systemInfo.isAndroid = isAndroid;
1116
1116
  _ShopSystemInfo = systemInfo;
1117
1117
  return systemInfo;
1118
1118
  const result = originDealShopContentData(pageData, draBusinessCustomReport, isvdev);
1119
1119
  if (isJdAndHarmonyDevice && isNewHarmonyShop) {
1120
1120
  result.shopContentContainerListData = result.shopContentContainerListData.filter(
1121
1121
  (item) =>
1122
1122
  item.floors.length > 0 &&
1123
1123
  !isInHarmonyBlacklistByModuleFlag(item.containerId, result.shopContentContainerListData),
1124
1124
  );
1125
1125
  }
1126
1126
  return result;
1127
1127
  const numScale = Number(scale);
1128
1128
  if (isNaN(numScale)) {
1129
1129
  console.warn(
1130
1130
  `The 'scale' parameter of the 'isInGrayscale' function is invalid! Expected a number, but received ${scale}`,
1131
1131
  );
1132
1132
  return false;
1133
1133
  }
1134
1134
  const { venderId } = global.info.queryInfo || {};
1135
1135
  const id = venderId;
1136
1136
  if (!id && numScale !== 1) {
1137
1137
  return false;
1138
1138
  }
1139
1139
  const useScale = Math.max(0, Math.min(1, numScale));
1140
1140
  const isMatch = numScale === 1 || Math.floor(Number(id) % (1 / useScale)) === 0;
1141
1141
  if (reportKey) {
1142
1142
  console.log(
1143
1143
  `基于KEY[${reportKey}]的灰度调用1次~`,
1144
1144
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_invoke`),
1145
1145
  );
1146
1146
  if (isMatch) {
1147
1147
  console.log(
1148
1148
  `基于KEY[${reportKey}]的命中1次灰度!`,
1149
1149
  getSgmCustomCode(`${SgmCustomCode.GRAYSCALE}_${reportKey}_hit`),
1150
1150
  );
1151
1151
  }
1152
1152
  }
1153
1153
  return isMatch;
1154
1154
  isJdApp,
1155
1155
  isWxApp,
1156
1156
  isIosDevice,
1157
1157
  isAndroidDevice,
1158
1158
  isHarmonyDevice,
1159
1159
  isJdAndIosDevice,
1160
1160
  isJdAndAndroidDevice,
1161
1161
  isJdAndHarmonyDevice,
1162
1162
  isNewHarmonyShop,
1163
1163
  isJdAndroidX5Core,
1164
1164
  isMin,
1165
1165
  isWxMin,
1166
1166
  isWxMinAndWxapp,
1167
1167
  isJdMinAndHarmony,
1168
1168
  isJdMin,
1169
1169
  isH5,
1170
1170
  isH5AndJdShopView,
1171
1171
  isChartH5,
1172
1172
  isH5AndJdShopViewNativeScroll,
1173
1173
  isH5AndJdShopViewH5Scroll,
1174
1174
  isH5AndJdShopH5CustomScrollView,
1175
1175
  isH5AndJingGouMini,
1176
1176
  isWxMiniH5View,
1177
1177
  isAscfApp,
1178
1178
  urlCookie,
1179
1179
  sliceArrToChunkList,
1180
1180
  dealAddress,
1181
1181
  objectToUrlEncode,
1182
1182
  parseQueryUrlString,
1183
1183
  setLowSmallPicUrl,
1184
1184
  setTaroStorage,
1185
1185
  getTaroStorageKeyValue,
1186
1186
  removeTaroStorageKey,
1187
1187
  clearTaroStorageKey,
1188
1188
  getAvifSupport,
1189
1189
  getWebpSupport,
1190
1190
  getQualityImage,
1191
1191
  formatCountForUnit as countStringify,
1192
1192
  getWxAppCookieStr,
1193
1193
  getSystemInfos,
1194
1194
  pxTransformFromData,
1195
1195
  dealShopContentDataAndReport as dealShopContentData,
1196
1196
  dateFormat,
1197
1197
  throttle,
1198
1198
  lodashThrottle,
1199
1199
  debounce,
1200
1200
  addHttps,
1201
1201
  commonShowSuccessToast as showSuccessToast,
1202
1202
  commonShowFailToast as showFailToast,
1203
1203
  commonShowNormalToast as showNormalToast,
1204
1204
  showShopLoading,
1205
1205
  hideShopLoading,
1206
1206
  stopNativeScrollEvent,
1207
1207
  getAppChannelType,
1208
1208
  formatTabActiveMenuType,
1209
1209
  filterUrlQueryData,
1210
1210
  draCustomReport,
1211
1211
  remoteCustomReport,
1212
1212
  draInterfaceCustomReport,
1213
1213
  draBusinessCustomReport,
1214
1214
  draBusinessCustomLogReport,
1215
1215
  isMemberPage,
1216
1216
  getFloorDataToDataDefines,
1217
1217
  isOpenJdAppUrl,
1218
1218
  jdOpenAppParams,
1219
1219
  createJdOpenAppUrl,
1220
1220
  isEmpty,
1221
1221
  getJdAppReportPageSource,
1222
1222
  isAppClassifyPage,
1223
1223
  isAppHomeForMarketPage,
1224
1224
  isImageOptimizeEnable,
1225
1225
  isPc,
1226
1226
  isPcClassifyPage,
1227
1227
  ipLoc_djd,
1228
1228
  isTjScence,
1229
1229
  isH5AdnJxMini,
1230
1230
  isTjM,
1231
1231
  isTjJxM,
1232
1232
  isTJApp,
1233
1233
  isH5AdnHaoWuJie,
1234
1234
  tjChannel,
1235
1235
  dealJdOpenAppData,
1236
1236
  jdAppVersionCompare,
1237
1237
  dealNativePixelToCssPixel,
1238
1238
  isAppStowShop,
1239
1239
  getSgmCustomCode,
1240
1240
  handleSgmCodeTaroVersion,
1241
1241
  isInGrayscale,
1242
1242
  isIpadDevice,
1243
1243
  getBorderStyle,
1244
1244
  isSupportHybridHttpRequest,
1245
1245
  isLanguageForEn,
1246
1246
  sColor,
1247
1247
  isTabletDevice,
1248
1248
  taroToTransformRoutimePXNumber,
1249
1249
  updateContainerWidth,
1250
1250
  isInJdShopView,
1251
1251
  isDongWebView,
1252
1252
  isLanguageForHk,
1253
1253
  languageNowType,
1254
1254
  isInJdAppH5DebugMode,
1255
1255
  isJdLiteApp,
1256
1256
  isJdAppForNotMain,