@conecli/cone-render 0.10.1-shop3.12 → 0.10.1-shop3.121

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