@conecli/cone-render 0.10.1-shop3.14 → 0.10.1-shop3.140

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