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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (128) hide show
  1. package/dist/api/index.ts +1 -1
  2. package/dist/common/accessibility.h5.ts +1 -0
  3. package/dist/common/accessibility.ts +0 -0
  4. package/dist/common/const.ts +1 -1
  5. package/dist/common/index.h5.ts +1 -1
  6. package/dist/common/index.jd.ts +1 -1
  7. package/dist/common/index.ts +1 -1
  8. package/dist/common/index.weapp.ts +1 -1
  9. package/dist/common/jdplayerSdk.weapp.tsx +1 -0
  10. package/dist/common/jssdk.weapp.ts +1 -0
  11. package/dist/common/pageType.ts +1 -1
  12. package/dist/common/token/index.h5.ts +1 -1
  13. package/dist/common/token/token.jd.ts +1 -1
  14. package/dist/common/wxappApi.ascf.ts +1 -0
  15. package/dist/components/ErrorBoundary.tsx +1 -1
  16. package/dist/components/base/CountDown/index.tsx +1 -1
  17. package/dist/components/base/CustomVideo/index.tsx +1 -1
  18. package/dist/components/base/CustomVideo/index.weapp.tsx +1 -0
  19. package/dist/components/base/ExposureSmart/index.h5.tsx +1 -1
  20. package/dist/components/base/ExposureSmart/index.tsx +1 -1
  21. package/dist/components/base/ExposureSmart/reporter.tsx +1 -1
  22. package/dist/components/base/InOrOutViewObserver/index.weapp.tsx +1 -0
  23. package/dist/components/base/ItemViewExposureSmart/index.tsx +1 -1
  24. package/dist/components/base/JdLoading/index.module.scss +0 -2
  25. package/dist/components/base/JdLoading/index.tsx +1 -1
  26. package/dist/components/base/LazyLayoutLoad/index.tsx +1 -1
  27. package/dist/components/base/LazyLoadImage/index.h5.tsx +1 -1
  28. package/dist/components/base/LazyLoadImage/index.tsx +1 -1
  29. package/dist/components/base/MobileCommonHeader/index.tsx +1 -1
  30. package/dist/components/base/MobileCommonHeader/index.weapp.tsx +1 -0
  31. package/dist/components/base/NetworkDataError/const.ts +1 -1
  32. package/dist/components/base/NetworkDataError/index.module.scss +1 -1
  33. package/dist/components/base/NetworkDataError/index.tsx +1 -1
  34. package/dist/components/base/Price/Base/index.tsx +1 -1
  35. package/dist/components/base/Price/Double/index.module.scss +1 -1
  36. package/dist/components/base/Price/Double/index.tsx +1 -1
  37. package/dist/components/base/ShopLeGaoTag/index.h5.module.scss +35 -0
  38. package/dist/components/base/ShopLeGaoTag/index.h5.tsx +1 -0
  39. package/dist/components/base/ShopLeGaoTag/index.module.scss +33 -0
  40. package/dist/components/base/ShopLeGaoTag/index.tsx +1 -0
  41. package/dist/components/floorItem.tsx +1 -1
  42. package/dist/components/isv/Floor/index.tsx +1 -1
  43. package/dist/components/remoteFloorItem.tsx +1 -1
  44. package/dist/config/env.ts +1 -1
  45. package/dist/interface/common.ts +1 -1
  46. package/dist/interface/component.ts +1 -1
  47. package/dist/interface/jumpEventReport.ts +1 -1
  48. package/dist/interface/service.ts +1 -1
  49. package/dist/jumpEventReport/base.ts +1 -1
  50. package/dist/jumpEventReport/const.ts +1 -1
  51. package/dist/jumpEventReport/createReportFloorData.ts +1 -1
  52. package/dist/jumpEventReport/index.h5.ts +1 -1
  53. package/dist/jumpEventReport/index.ts +1 -1
  54. package/dist/jumpEventReport/index.weapp.ts +1 -1
  55. package/dist/jumpEventReport/jdJumpJdApp.ts +1 -1
  56. package/dist/jumpEventReport/jumpUrlConfig/base.ts +1 -1
  57. package/dist/jumpEventReport/logEventConfig.h5.ts +1 -0
  58. package/dist/jumpEventReport/logEventConfig.ts +1 -1
  59. package/dist/jumpEventReport/web/report.ts +1 -1
  60. package/dist/jumpEventReport/web.base.ts +1 -1
  61. package/dist/jumpEventReport/web.jd.ts +1 -1
  62. package/dist/jumpEventReport/web.pc.ts +1 -1
  63. package/dist/jumpEventReport/web.wxapp.ts +1 -1
  64. package/dist/language/en_US.json +233 -83
  65. package/dist/language/zh_CN.json +232 -82
  66. package/dist/language/zh_HK.json +232 -82
  67. package/dist/libs/openShopBridge.js +161 -0
  68. package/dist/libs/openShopBridge.min.js +1 -0
  69. package/dist/libs/taroAppReport.js +2 -2
  70. package/dist/modules/ContainerFloorList/index.h5.module.scss +16 -2
  71. package/dist/modules/ContainerFloorList/index.h5.tsx +1 -1
  72. package/dist/modules/ContainerFloorList/index.tsx +1 -1
  73. package/dist/modules/DecorateContainerFloorList/index.weapp.tsx +1 -0
  74. package/dist/open/api/index.ts +1 -1
  75. package/dist/open/api/shopMember.ts +1 -1
  76. package/dist/open/api/shopMember.weapp.ts +1 -0
  77. package/dist/open/api/track.ts +1 -1
  78. package/dist/open/api/util.ts +1 -1
  79. package/dist/open/components/index.ts +1 -1
  80. package/dist/open/index.ts +1 -1
  81. package/dist/sass/app.h5.scss +6 -1
  82. package/dist/sass/base.scss +8 -4
  83. package/dist/service/fetchGateway.ts +1 -1
  84. package/dist/service/fetchGateway.weapp.ts +1 -1
  85. package/dist/service/fetchJsonp.ts +1 -1
  86. package/dist/service/fetchJsonp.weapp.ts +1 -0
  87. package/dist/service/http/h5Http.ts +1 -1
  88. package/dist/service/http/http.ts +1 -1
  89. package/dist/service/http/httpInterceptors.weapp.ts +1 -0
  90. package/dist/service/requestServer.h5.ts +1 -1
  91. package/dist/service/requestServer.ts +1 -1
  92. package/dist/service/requestServer.weapp.ts +1 -1
  93. package/dist/utils/connectNativeJsBridge.ts +1 -1
  94. package/dist/utils/h5Utils.ts +1 -1
  95. package/dist/utils/harmonyCallRouter.h5.ts +1 -0
  96. package/dist/utils/harmonyCallRouter.ts +0 -0
  97. package/dist/utils/index.h5.ts +1 -1
  98. package/dist/utils/index.ts +1 -1
  99. package/dist/utils/index.weapp.ts +1 -1
  100. package/dist/utils/intersectionObserver.ts +1 -1
  101. package/dist/utils/sColor.weapp.ts +1 -0
  102. package/dist/utils/utils.ts +1 -1
  103. package/package.json +36 -38
  104. package/dist/common/index.dynamic.ts +0 -1
  105. package/dist/components/base/Dialog/index.dynamic.module.scss +0 -126
  106. package/dist/components/base/Dialog/index.dynamic.tsx +0 -1
  107. package/dist/components/base/DynamicTest/index.dynamic.module.scss +0 -15
  108. package/dist/components/base/DynamicTest/index.module.scss +0 -16
  109. package/dist/components/base/DynamicTest/index.tsx +0 -1
  110. package/dist/components/base/LazyLoadImage/index.dynamic.module.scss +0 -40
  111. package/dist/components/base/LazyLoadImage/index.dynamic.tsx +0 -1
  112. package/dist/components/base/NetworkDataError/index.dynamic.module.scss +0 -95
  113. package/dist/components/base/NetworkDataError/index.dynamic.tsx +0 -1
  114. package/dist/components/base/Price/Base/index.dynamic.module.scss +0 -63
  115. package/dist/components/base/Price/Base/index.dynamic.tsx +0 -1
  116. package/dist/components/base/Price/Double/index.dynamic.module.scss +0 -172
  117. package/dist/components/base/Price/Double/index.dynamic.tsx +0 -1
  118. package/dist/jumpEventReport/index.dynamic.ts +0 -1
  119. package/dist/jumpEventReport/web/wqshop.report.ts +0 -1
  120. package/dist/open/api/shopMember.dynamic.ts +0 -1
  121. package/dist/open/components/index.dynamic.ts +0 -1
  122. package/dist/sass/app.dynamic.scss +0 -306
  123. package/dist/service/fetchGateway.h5.ts +0 -1
  124. package/dist/service/fetchJsonp.h5.ts +0 -1
  125. package/dist/service/http/colorSign.dynamic.ts +0 -1
  126. package/dist/utils/connectNativeJsBridge.dynamic.ts +0 -1
  127. package/dist/utils/priceUtils.js +0 -1
  128. /package/dist/utils/{sColor.js → sColor.ts} +0 -0
@@ -1 +1 @@
1
- import Taro from '@tarojs/taro';
2
1
  SHOP_MENU_ID_TYPE,
3
2
  SHOP_MENU_ID_QUERY_NAME,
4
3
  SECTION_HOME_TAB_TYPE,
5
4
  SECTION_HOME_TAB_NAME_TYPE,
6
5
  SECTION_HOME_TAB_QUERY_TYPE,
7
6
  SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY,
8
7
  CHANNEL_TYPE,
9
8
  JDShopViewBusinessPathType,
10
9
  FloorModuleType,
11
10
  RemoteLoadFloorList,
12
11
  FLOOR_KIND,
13
12
  getBundleUrl,
14
13
  getBundleFileName,
15
14
  formatPackResult,
16
15
  getTaroVersion,
17
16
  /ipad/i.test(system) || (/android/i.test(system) && !/mobi|mini|fennec/i.test(system));
18
17
  key: string,
19
18
  value: string | object,
20
19
  successBack?: any,
21
20
  failBack?: any,
22
21
  try {
23
22
  if (isH5 && window && !window.localStorage) {
24
23
  console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
25
24
  return Promise.resolve(null);
26
25
  }
27
26
  return Taro.setStorage({
28
27
  key: key,
29
28
  data: value,
30
29
  success: successBack,
31
30
  fail: failBack,
32
31
  }).catch((e) => {
33
32
  console.log(`setTaroStorage key:${key} 报错:`, e);
34
33
  return null;
35
34
  });
36
35
  } catch (e) {
37
36
  console.log(`setTaroStorage key:${key} 报错:`, e);
38
37
  return Promise.resolve(null);
39
38
  }
40
39
  try {
41
40
  if (isH5 && window && !window.localStorage) {
42
41
  console.log(`getTaroStorageKeyValue key:${key} window.localStorage不存在:`);
43
42
  return Promise.resolve(null);
44
43
  }
45
44
  return Taro.getStorageSync(key);
46
45
  } catch (e) {
47
46
  console.log(`getTaroStorageKeyValue key:${key} 报错:`, e);
48
47
  return null;
49
48
  }
50
49
  try {
51
50
  if (isH5 && window && !window.localStorage) {
52
51
  console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`);
53
52
  return Promise.resolve(null);
54
53
  }
55
54
  return Taro.removeStorage({
56
55
  key: key,
57
56
  }).catch((e) => {
58
57
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
59
58
  });
60
59
  } catch (e) {
61
60
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
62
61
  }
63
62
  try {
64
63
  if (isH5 && window && !window.localStorage) {
65
64
  console.log(`clearTaroStorageKey window.localStorage不存在`);
66
65
  return Promise.resolve(null);
67
66
  }
68
67
  return Taro.clearStorage().catch((e) => {
69
68
  console.log('clearTaroStorageKey报错:', e);
70
69
  });
71
70
  } catch (e) {
72
71
  console.log('clearTaroStorageKey报错:', e);
73
72
  }
74
73
  let hasChecked = false;
75
74
  if (isH5) {
76
75
  const avifCache = getTaroStorageKeyValue(KEY_AVIF);
77
76
  if (avifCache === null || avifCache === '' || forceUpdate) {
78
77
  hasChecked = true;
79
78
  const img = new Image();
80
79
  img.onload = function () {
81
80
  if (img.height > 0 && img.width > 0) {
82
81
  setTaroStorage(KEY_AVIF, '1');
83
82
  } else {
84
83
  setTaroStorage(KEY_AVIF, '0');
85
84
  }
86
85
  };
87
86
  img.onerror = () => {
88
87
  setTaroStorage(KEY_AVIF, '0');
89
88
  };
90
89
  img.src =
91
90
  'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
92
91
  }
93
92
  const webpCache = getTaroStorageKeyValue(KEY_WEBP);
94
93
  if (webpCache === null || webpCache === '' || forceUpdate) {
95
94
  hasChecked = true;
96
95
  const img = new Image();
97
96
  img.onload = function () {
98
97
  if (img.height > 0 && img.width > 0) {
99
98
  setTaroStorage(KEY_WEBP, '1');
100
99
  } else {
101
100
  setTaroStorage(KEY_WEBP, '0');
102
101
  }
103
102
  };
104
103
  img.onerror = () => {
105
104
  setTaroStorage(KEY_WEBP, '0');
106
105
  };
107
106
  img.src =
108
107
  'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
109
108
  }
110
109
  }
111
110
  return hasChecked;
112
111
  const hasChecked = imageFormatSupport(false);
113
112
  if (!hasChecked) {
114
113
  setTimeout(imageFormatSupport, 5000);
115
114
  }
116
115
  const resultList: Array<any> = [],
117
116
  arrLen = arr.length;
118
117
  if (arrLen) {
119
118
  if (arrLen > size) {
120
119
  for (let i = 0; i < arrLen; i = i + size) {
121
120
  resultList.push(arr.slice(i, i + size));
122
121
  }
123
122
  } else {
124
123
  resultList.push(arr);
125
124
  }
126
125
  }
127
126
  return resultList;
128
127
  let _address = ids;
129
128
  const _areaAreaSplit = ids.split('.');
130
129
  const _areaAreaSplit2 = ids.split('_');
131
130
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
132
131
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
133
132
  return _address;
134
133
  let paramStr = '';
135
134
  obj &&
136
135
  Object.keys(obj).forEach((key, index) => {
137
136
  const getValue = `${obj[key]}`.replace(/undefined/, '').replace(/null/, '');
138
137
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`;
139
138
  });
140
139
  return paramStr;
141
140
  const result = {};
142
141
  if (
143
142
  !urlOrQueryStr ||
144
143
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
145
144
  ) {
146
145
  return result;
147
146
  }
148
147
  if (urlOrQueryStr.indexOf('?') > -1) {
149
148
  const queryStr = urlOrQueryStr.split('?');
150
149
  const queryItemList = queryStr && queryStr.length > 1 ? queryStr[1].split('&') : [];
151
150
  const queryItemListLen = queryItemList.length;
152
151
  queryItemListLen > 0 &&
153
152
  queryItemList.forEach((item) => {
154
153
  const thisItemList = item.split('=');
155
154
  result[thisItemList[0]] = thisItemList[1];
156
155
  });
157
156
  } else {
158
157
  const queryItemList =
159
158
  urlOrQueryStr.indexOf('&') > -1 ? urlOrQueryStr.split('&') : [urlOrQueryStr];
160
159
  const queryItemListLen = queryItemList.length;
161
160
  queryItemListLen > 0 &&
162
161
  queryItemList.forEach((item) => {
163
162
  const thisItemList = item.split('=');
164
163
  result[thisItemList[0]] = thisItemList[1];
165
164
  });
166
165
  }
167
166
  return result;
168
167
  url: string,
169
168
  size?: {
170
169
  w: number;
171
170
  h: number;
172
171
  },
173
172
  quality?: number,
174
173
  if (url && size) {
175
174
  const _w = Math.floor(size.w);
176
175
  const _h = Math.floor(size.h);
177
176
  if (url.match(/gif$/i)) {
178
177
  return url;
179
178
  } else {
180
179
  if (_w > 0 && _h > 0) {
181
180
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`);
182
181
  }
183
182
  url += quality != null ? `!q${quality}.dpg` : '.dpg';
184
183
  }
185
184
  }
186
185
  return url;
187
186
  if (url.match(/\.(jpg|png|dpg)$/i)) {
188
187
  const { width, height, quality } = jfsImgInfo;
189
188
  if (typeof width === 'number' || typeof height === 'number') {
190
189
  url = url.replace('/jfs/', `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`);
191
190
  }
192
191
  if (typeof quality === 'number' && quality > 0 && quality < 100 && url.match(/\.jpg$/i)) {
193
192
  url += `!q${quality}.dpg`;
194
193
  }
195
194
  }
196
195
  return addHttps(url);
197
196
  if (imgUrl) {
198
197
  if (
199
198
  !imgUrl.match(
200
199
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
201
200
  )
202
201
  ) {
203
202
  if (!imgUrl.includes('360buyimg.com')) {
204
203
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
205
204
  }
206
205
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
207
206
  }
208
207
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
209
208
  }
210
209
  return imgUrl;
211
210
  const result = value % step;
212
211
  return result === 0 ? value : Math.ceil(value / step) * step;
213
212
  const MAX = 3.5;
214
213
  return Math.min(window?.devicePixelRatio ?? 2, MAX);
215
214
  isSkuImage: boolean;
216
215
  size: number;
217
216
  needCompress: boolean;
218
217
  imgUrl: string,
219
218
  options: QualityOptions,
220
219
  isIgnoreOptimizeFromServer: boolean = false,
221
220
  if (!imgUrl) {
222
221
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!');
223
222
  return imgUrl;
224
223
  }
225
224
  if (isIgnoreOptimizeFromServer) {
226
225
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1');
227
226
  }
228
227
  if (!/^((https?):)?\/\//.test(imgUrl)) {
229
228
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
230
229
  }
231
230
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i;
232
231
  if (!imgServerRegExp.test(imgUrl)) {
233
232
  return imgUrl;
234
233
  }
235
234
  imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl;
236
235
  const { isSkuImage, size, needCompress = true } = options || {};
237
236
  const needReduceSize = isSkuImage && size;
238
237
  if (needReduceSize) {
239
238
  const devicePixelRatio = getDevicePixelRatio();
240
239
  const useWidth = getValueByStep(size * devicePixelRatio, 40);
241
240
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useWidth}_jfs/`);
242
241
  }
243
242
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/);
244
243
  if (needCompress && result) {
245
244
  if (getAvifSupport() === '1') {
246
245
  imgUrl += '.avif';
247
246
  } else if (getWebpSupport() === '1') {
248
247
  imgUrl += '.webp';
249
248
  } else if (/jpe?g/.test(result[1])) {
250
249
  imgUrl += '!q80';
251
250
  }
252
251
  }
253
252
  if (needReduceSize) {
254
253
  imgUrl += '!z2';
255
254
  }
256
255
  return imgUrl;
257
256
  if (imgUrl) {
258
257
  if (
259
258
  !imgUrl.match(
260
259
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
261
260
  )
262
261
  ) {
263
262
  if (!imgUrl.includes('360buyimg.com')) {
264
263
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
265
264
  }
266
265
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
267
266
  }
268
267
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
269
268
  }
270
269
  return imgUrl;
271
270
  return getTaroStorageKeyValue(KEY_AVIF) || '0';
272
271
  return getTaroStorageKeyValue(KEY_WEBP) || '0';
273
272
  count: number,
274
273
  fixedNum = 1,
275
274
  unit = '万',
276
275
  maxNum = 10000,
277
276
  count = Number(count);
278
277
  const getMaxNum = count > 100000000 ? 100000000 : maxNum;
279
278
  const getUnit = count > 100000000 ? '亿' : unit;
280
279
  if (count >= getMaxNum) {
281
280
  return (count / getMaxNum).toFixed(fixedNum) + getUnit;
282
281
  }
283
282
  return count;
284
283
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
285
284
  platform: '',
286
285
  model: '',
287
286
  system: '',
288
287
  };
289
288
  if (!systemInfo.statusBarHeight) {
290
289
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
291
290
  systemInfo.navBarExtendHeight = 0;
292
291
  } else {
293
292
  if(!isDynamic){
294
293
  systemInfo.navBarExtendHeight = isIosDevice ? 4 : 0
295
294
  }
296
295
  }
297
296
  if(!isDynamic){
298
297
  let rect = Taro.getMenuButtonBoundingClientRect ? Taro.getMenuButtonBoundingClientRect() : null;
299
298
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
300
299
  let gap = 0;
301
300
  let width = 96;
302
301
  if (systemInfo.platform === 'android') {
303
302
  gap = 8;
304
303
  width = 96;
305
304
  } else if (systemInfo.platform === 'devtools') {
306
305
  if (isIosDevice) {
307
306
  gap = 5.5;
308
307
  } else {
309
308
  gap = 7.5;
310
309
  }
311
310
  } else {
312
311
  gap = 4;
313
312
  width = 88;
314
313
  }
315
314
  rect = {
316
315
  bottom: systemInfo.statusBarHeight + gap + 32,
317
316
  height: 32,
318
317
  left: systemInfo.windowWidth - width - 10,
319
318
  right: systemInfo.windowWidth - 10,
320
319
  top: systemInfo.statusBarHeight + gap,
321
320
  width,
322
321
  };
323
322
  }
324
323
  const gap = rect.top - systemInfo.statusBarHeight;
325
324
  systemInfo.navBarTopToStatusBar = gap;
326
325
  systemInfo.navBarHeight = 2 * gap + rect.height;
327
326
  systemInfo.capsulePosition = rect;
328
327
  }else {
329
328
  systemInfo['jdAppVersion'] = jdAppVersionStr
330
329
  }
331
330
  systemInfo.isIOS = isIosDevice;
332
331
  systemInfo.isAndroid = isAndroidDevice;
333
332
  console.log("获取系统信息",systemInfo);
334
333
  return systemInfo;
335
334
  if (str.match(/^\/\//)) {
336
335
  str = 'https:' + str;
337
336
  }
338
337
  return str;
339
338
  dateTimeOrdate: Date | string | number | null,
340
339
  format = 'yyyy-MM-dd HH:mm:ss',
341
340
  noPadStart = {
342
341
  M: '0',
343
342
  d: '0',
344
343
  H: '0',
345
344
  m: '0',
346
345
  s: '0',
347
346
  },
348
347
  let dateResult = '';
349
348
  const padStarts = Object.assign(
350
349
  {
351
350
  M: '0',
352
351
  d: '0',
353
352
  H: '0',
354
353
  m: '0',
355
354
  s: '0',
356
355
  },
357
356
  noPadStart,
358
357
  );
359
358
  if (dateTimeOrdate) {
360
359
  let changeDateTimeOrdate = dateTimeOrdate;
361
360
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
362
361
  if (getChangeDateTimeToNumber) {
363
362
  changeDateTimeOrdate = getChangeDateTimeToNumber;
364
363
  } else {
365
364
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/');
366
365
  }
367
366
  const nowDate =
368
367
  dateTimeOrdate instanceof Date ? dateTimeOrdate : new Date(changeDateTimeOrdate);
369
368
  const dateMap = {
370
369
  y: `${nowDate.getFullYear()}`,
371
370
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
372
371
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
373
372
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
374
373
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
375
374
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
376
375
  };
377
376
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g');
378
377
  const regYear = new RegExp('y');
379
378
  dateResult = format.replace(regDate, (v) => {
380
379
  let changeValue = v;
381
380
  if (regYear.test(changeValue)) {
382
381
  const thisYear = dateMap.y;
383
382
  const subValueLen = 4 - changeValue.length;
384
383
  changeValue = thisYear.substr(subValueLen);
385
384
  } else {
386
385
  const dateKey = v.substr(0, 1);
387
386
  changeValue = dateMap[dateKey];
388
387
  }
389
388
  return changeValue;
390
389
  });
391
390
  }
392
391
  return dateResult;
393
392
  let timer: any = null;
394
393
  let startTime = Date.now();
395
394
  return function () {
396
395
  const curTime = Date.now();
397
396
  const remaining = delay - (curTime - startTime);
398
397
  const context = this;
399
398
  const args = arguments;
400
399
  clearTimeout(timer);
401
400
  if (remaining <= 0) {
402
401
  func.apply(context, args);
403
402
  startTime = Date.now();
404
403
  } else {
405
404
  timer = setTimeout(func, remaining);
406
405
  }
407
406
  };
408
407
  let context, args, result;
409
408
  let timeout = null;
410
409
  let previous = 0;
411
410
  if (!options) options = {};
412
411
  const later = function () {
413
412
  previous = options.leading === false ? 0 : Date.now();
414
413
  timeout = null;
415
414
  result = func.apply(context, args);
416
415
  if (!timeout) context = args = null;
417
416
  };
418
417
  return function () {
419
418
  const now = Date.now();
420
419
  if (!previous && options.leading === false) previous = now;
421
420
  const remaining = wait - (now - previous);
422
421
  context = this;
423
422
  args = arguments;
424
423
  if (remaining <= 0 || remaining > wait) {
425
424
  if (timeout) {
426
425
  clearTimeout(timeout);
427
426
  timeout = null;
428
427
  }
429
428
  previous = now;
430
429
  result = func.apply(context, args);
431
430
  if (!timeout) context = args = null;
432
431
  } else if (!timeout && options.trailing !== false) {
433
432
  timeout = setTimeout(later, remaining);
434
433
  }
435
434
  return result;
436
435
  };
437
436
  let timer: any = null;
438
437
  return function () {
439
438
  const context: any = this;
440
439
  const args = arguments;
441
440
  timer && clearTimeout(timer);
442
441
  timer = setTimeout(function () {
443
442
  fn.apply(context, args);
444
443
  }, delay);
445
444
  };
446
445
  if (txt) {
447
446
  txt = txt.trim();
448
447
  const reg = new RegExp(/[\d-]+/);
449
448
  const res = reg.exec(txt);
450
449
  if (res && res.length > 0) {
451
450
  let tel = res[0];
452
451
  if (tel && delSeparator) {
453
452
  tel = tel.replace(/-/g, '');
454
453
  }
455
454
  return tel;
456
455
  }
457
456
  }
458
457
  return '';
459
458
  if (rgb) {
460
459
  const reg = /^(rgb|RGB)/;
461
460
  const color = rgb;
462
461
  if (reg.test(color)) {
463
462
  let strHex = '#';
464
463
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
465
464
  for (let i = 0; i < colorArr.length; i++) {
466
465
  let hex = Number(colorArr[i]).toString(16);
467
466
  if (hex === '0') {
468
467
  hex += hex;
469
468
  }
470
469
  strHex += hex;
471
470
  }
472
471
  return strHex;
473
472
  } else {
474
473
  return String(color);
475
474
  }
476
475
  } else {
477
476
  return '';
478
477
  }
479
478
  if (hex) {
480
479
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
481
480
  let color = hex.toLowerCase();
482
481
  if (reg.test(color)) {
483
482
  if (color.length === 4) {
484
483
  let colorNew = '#';
485
484
  for (let i = 1; i < 4; i += 1) {
486
485
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
487
486
  }
488
487
  color = colorNew;
489
488
  }
490
489
  const colorChange: number[] = [];
491
490
  for (let i = 1; i < 7; i += 2) {
492
491
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)));
493
492
  }
494
493
  if (returnList) {
495
494
  return colorChange;
496
495
  } else {
497
496
  return 'RGB(' + colorChange.join(',') + ')';
498
497
  }
499
498
  } else {
500
499
  return color;
501
500
  }
502
501
  } else {
503
502
  return '';
504
503
  }
505
504
  const c = m - n + 1;
506
505
  const res = Math.floor(Math.random() * c + n);
507
506
  if (filterNum && filterNum == res) {
508
507
  console.log('随机数二次开始', res, filterNum);
509
508
  return getRandom(n, m, filterNum);
510
509
  } else {
511
510
  return res;
512
511
  }
513
512
  wqCookieStr: string;
514
513
  wqCookie: {
515
514
  pin?: string;
516
515
  visitkey?: string;
517
516
  [key: string]: any;
518
517
  };
519
518
 
520
519
  const {
521
520
  jdpin,
522
521
  pinStatus,
523
522
  visitkey,
524
523
  unionid,
525
524
  skey,
526
525
  __jda,
527
526
  __jdv,
528
527
  __wga,
529
528
  wid,
530
529
  wq_skey,
531
530
  wq_uin,
532
531
  wq_auth_token,
533
532
  wxapp_scene,
534
533
  wq_unionid,
535
534
  wxapp_openid,
536
535
  wxapp_version,
537
536
  wxapp_type,
538
537
  appType,
539
538
  lbs_addr,
540
539
  } = cookie;
541
540
  const ret: string[] = [];
542
541
  const getUserCookieObj = {};
543
542
  const createUseCookieArr = [
544
543
  jdpin,
545
544
  pinStatus,
546
545
  visitkey,
547
546
  unionid,
548
547
  skey,
549
548
  __jda,
550
549
  __jdv,
551
550
  __wga,
552
551
  wid,
553
552
  wq_skey,
554
553
  wq_uin,
555
554
  wq_auth_token,
556
555
  wxapp_scene,
557
556
  wq_unionid,
558
557
  wxapp_openid,
559
558
  wxapp_version,
560
559
  wxapp_type,
561
560
  appType,
562
561
  lbs_addr,
563
562
  ];
564
563
 
565
564
  createUseCookieArr.forEach((keyItem) => {
566
565
  if (keyItem && keyItem['name']) {
567
566
  let { name, value } = keyItem;
568
567
  name = name === 'jdpin' ? 'pin' : name;
569
568
  name === 'pin' && ret.push(`pt_pin=${encodeURIComponent(value)}`);
570
569
  ret.push(`${name}=${encodeURIComponent(value)}`);
571
570
  getUserCookieObj[name] = value;
572
571
  }
573
572
  });
574
573
  return {
575
574
  wqCookieStr: ret.join(';'),
576
575
  wqCookie: getUserCookieObj,
577
576
  };
578
577
  const getLayoutWidth = layoutWidth || windowWidth;
579
578
  const getNum = Number(num);
580
579
  return Math.round((getNum / widthSize) * getLayoutWidth);
581
580
  let checkState = false;
582
581
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
583
582
  if (couponFloorModuleType === FloorModuleType.COUPON) {
584
583
  try {
585
584
  const dataDefines = getFloorDataToDataDefines(floorData);
586
585
  const couponDataDefine = dataDefines
587
586
  ? dataDefines.filter((item) => {
588
587
  return item.type === 'coupon';
589
588
  })
590
589
  : [],
591
590
  couponList = couponDataDefine[0]?.nodeText?.data ? couponDataDefine[0]?.nodeText?.data : [],
592
591
  couponLength = couponList.length,
593
592
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
594
593
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
595
594
  : 0;
596
595
  if (numShowPerLine === 0 && couponLength > 3) {
597
596
  checkState = true;
598
597
  }
599
598
  } catch (e) {
600
599
  checkState = false;
601
600
  }
602
601
  return checkState;
603
602
  }
604
603
  const {
605
604
  containers = [],
606
605
  floors = [],
607
606
  clearFirstContaierMarginTop = false,
608
607
  } = pageData;
609
608
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev);
610
609
  const getThisTimeKey = Date.now();
611
610
  let shopContentContainerListData = containers?.filter(
612
611
  (item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
613
612
  );
614
613
  const shopContentFloorListData = floors?.filter(
615
614
  ({ floorPosition }) =>
616
615
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') || isvdev,
617
616
  );
618
617
  const unableIsvContainerListData = getUnableIsvContainerListData(
619
618
  shopContentFloorListData,
620
619
  shopContentContainerListData,
621
620
  exceptionReportFn,
622
621
  );
623
622
  shopContentContainerListData.forEach((item, index) => {
624
623
  item.key = `${getThisTimeKey + index}`;
625
624
  item.floors = [];
626
625
  item.includeUids &&
627
626
  item.includeUids.forEach((floorUid) => {
628
627
  const getFloorData = shopContentFloorListData.find(
629
628
  (floorItem) => floorItem.uid === floorUid,
630
629
  );
631
630
  if (getFloorData) {
632
631
  const changeFloorData = {
633
632
  containerId: item.containerId,
634
633
  containerIndex: index,
635
634
  ...getFloorData,
636
635
  };
637
636
  const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(getFloorData);
638
637
  if (getCheckMoreCouponState) {
639
638
  item.marginLeft && (item.marginLeft = 0);
640
639
  item.marginRight && (item.marginRight = 0);
641
640
  item.borderRadius && (item.borderRadius = 0);
642
641
  }
643
642
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
644
643
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn);
645
644
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1);
646
645
  }
647
646
  item.floors.push(changeFloorData);
648
647
  }
649
648
  });
650
649
  if (
651
650
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
652
651
  item?.containerPosition == 'content' &&
653
652
  item?.marginBottom > 0 &&
654
653
  !clearFirstContaierMarginTop
655
654
  ) {
656
655
  item.marginTop = item.marginBottom;
657
656
  }
658
657
  });
659
658
  shopContentContainerListData = shopContentContainerListData.filter(
660
659
  (item) =>
661
660
  item.floors.length > 0 &&
662
661
  unableIsvContainerListData.every(
663
662
  (containerItem) => containerItem.containerId != item.containerId,
664
663
  ),
665
664
  );
666
665
  console.log(
667
666
  'dealShopContentData isWxMinAndWxapp:',
668
667
  isWxMinAndWxapp,
669
668
  'weappJumpToH5:',
670
669
  pageData?.homeExtInfo?.weappJumpToH5,
671
670
  );
672
671
  if (isProd && isWxMinAndWxapp) {
673
672
  shopContentContainerListData = shopContentContainerListData.filter(
674
673
  (item) =>
675
674
  item.floors.length > 0 &&
676
675
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData),
677
676
  );
678
677
  }
679
678
  shopContentContainerListData = [].concat(shopContentContainerListData);
680
679
  return {
681
680
  shopContentContainerListData,
682
681
  shopContentFloorListData,
683
682
  };
684
683
  const changeOpts = {
685
684
  duration: 2000,
686
685
  iconType: 2,
687
686
  ...opts
688
687
  }
689
688
  Taro.JDRouter.callRouter({
690
689
  url: isJdAndAndroidDevice ? 'router://JDJShopModule/showToast' : 'router://JDShopModule/showToast',
691
690
  params: {
692
691
  message: changeOpts.title,
693
692
  iconType: changeOpts.iconType,
694
693
  duration: changeOpts.duration,
695
694
  }
696
695
  }).then(res => {
697
696
  console.log("success:", "Taro.JDRouter.callRouter调用原生底层toast成功"+ res)
698
697
  })
699
698
  const changeOpts = {
700
699
  title: '',
701
700
  icon: 'success',
702
701
  duration: 1500,
703
702
  mask: true,
704
703
  ...options,
705
704
  };
706
705
  if (changeOpts.title.length > 7) {
707
706
  showNormalToast(options);
708
707
  } else {
709
708
  isDynamic ? dealDynamicNativeToast({
710
709
  ...changeOpts,
711
710
  icon: 2,
712
711
  }) : Taro.showToast(changeOpts as any);
713
712
  }
714
713
  const changeOpts = {
715
714
  title: '',
716
715
  icon: 'error',
717
716
  duration: 1500,
718
717
  mask: true,
719
718
  ...options,
720
719
  };
721
720
  if (changeOpts.title.length > 7) {
722
721
  showNormalToast(options);
723
722
  } else {
724
723
  isDynamic ? dealDynamicNativeToast({
725
724
  ...changeOpts,
726
725
  icon: 3,
727
726
  }) : Taro.showToast(changeOpts as any);
728
727
  }
729
728
  Taro.showToast({
730
729
  title: '',
731
730
  icon: 'none',
732
731
  duration: 1500,
733
732
  mask: true,
734
733
  ...options,
735
734
  });
736
735
  return !isDynamic ? Taro.showLoading({
737
736
  title: text,
738
737
  }) : Taro.showToast({
739
738
  title: 'loading...',
740
739
  });
741
740
  return new Promise(() => {
742
741
  Taro.nextTick(() => {
743
742
  setTimeout(() => {
744
743
  !isDynamic && Taro.hideLoading(options);
745
744
  }, 300);
746
745
  });
747
746
  });
748
747
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
749
748
  const {
750
749
  tabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
751
750
  sceneId,
752
751
  } = query;
753
752
  let changeTabActive = tabActive;
754
753
  if (sceneId) {
755
754
  if (isH5) {
756
755
  if (sceneId == '1002') {
757
756
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
758
757
  }
759
758
  else if (sceneId == '1003') {
760
759
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
761
760
  }
762
761
  } else if (isWxMinAndWxapp) {
763
762
  if (sceneId == '1001' || sceneId == '1002') {
764
763
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
765
764
  }
766
765
  else if (sceneId == '1003') {
767
766
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
768
767
  }
769
768
  }
770
769
  }
771
770
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
772
771
  return {
773
772
  menuType: SHOP_MENU_ID_TYPE.HOME,
774
773
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
775
774
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
776
775
  };
777
776
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
778
777
  return {
779
778
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
780
779
  tabActiveType: 0,
781
780
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
782
781
  };
783
782
  } else {
784
783
  const defaultMenuType = {
785
784
  menuType: SHOP_MENU_ID_TYPE.HOME,
786
785
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
787
786
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
788
787
  };
789
788
  const isCustomTab = tabActive.indexOf(SECTION_HOME_TAB_NAME_TYPE.HOME_CUSTOM) !== -1;
790
789
  if (isCustomTab) {
791
790
  const customTabType = Number(tabActive.split('-')[2]);
792
791
  if (
793
792
  !isNaN(customTabType) &&
794
793
  SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(customTabType) !== -1
795
794
  ) {
796
795
  return {
797
796
  menuType: SHOP_MENU_ID_TYPE.HOME,
798
797
  tabActiveType: customTabType,
799
798
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${customTabType}`,
800
799
  };
801
800
  } else {
802
801
  return defaultMenuType;
803
802
  }
804
803
  } else {
805
804
  return defaultMenuType;
806
805
  }
807
806
  }
808
807
  const deleteKeyList = [
809
808
  '$taroTimestamp',
810
809
  'cookie',
811
810
  'wdref',
812
811
  'navStart',
813
812
  'originOpts',
814
813
  'originParams',
815
814
  'originUrl',
816
815
  'referer',
817
816
  'stamp',
818
817
  'hybrid',
819
818
  'sr',
820
819
  'navh',
821
820
  'stath',
822
821
  ];
823
822
  let changeQueryData: any = { ...queryData };
824
823
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
825
824
  const sceneQuery =
826
825
  qrCodeScene && typeof qrCodeScene === 'string'
827
826
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
828
827
  : {};
829
828
  changeQueryData = { ...changeQueryData, ...sceneQuery };
830
829
  deleteKeyList.forEach((key) => {
831
830
  changeQueryData[key] && delete changeQueryData[key];
832
831
  });
833
832
  Object.keys(changeQueryData).forEach((key) => {
834
833
  if (changeQueryData[key] && Array.isArray(changeQueryData[key])) {
835
834
  changeQueryData[key] = changeQueryData[key][0] || '';
836
835
  }
837
836
  });
838
837
  changeQueryData['shopid'] &&
839
838
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
840
839
  delete changeQueryData['shopid'];
841
840
  changeQueryData['venderid'] &&
842
841
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
843
842
  delete changeQueryData['venderid'];
844
843
  changeQueryData['vendorId'] &&
845
844
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
846
845
  delete changeQueryData['vendorId'];
847
846
  changeQueryData['shopId'] &&
848
847
  changeQueryData['shopId'] === 'undefined' &&
849
848
  delete changeQueryData['shopId'];
850
849
  changeQueryData['venderId'] &&
851
850
  changeQueryData['venderId'] === 'undefined' &&
852
851
  delete changeQueryData['venderId'];
853
852
  return changeQueryData;
854
853
  let isUsable = false;
855
854
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
856
855
  const modularPackResultObj = formatPackResult(modularPackResult);
857
856
  const bundleUrl = getBundleUrl(modularPackResultObj);
858
857
  const bundleFileName = getBundleFileName(modularPackResultObj);
859
858
  const taroVersion = getTaroVersion(modularPackResultObj);
860
859
  if (bundleUrl && bundleFileName) {
861
860
  isUsable = true;
862
861
  }
863
862
  if (!isUsable && typeof exceptionReportFn === 'function') {
864
863
  exceptionReportFn({
865
864
  code: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
866
865
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
867
866
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
868
867
  : SgmCustomCode.REMOTEMODULE_DATA
869
868
  }`,
870
869
  msg: {
871
870
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
872
871
  floorIdx: floorData?.floorIdx,
873
872
  uid: floorData?.uid,
874
873
  shopId: floorData?.floorExtInfo?.shopId,
875
874
  moduleId: floorData?.moduleId,
876
875
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
877
876
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
878
877
  floorKind: floorData?.floorExtInfo?.floorKind,
879
878
  middleTemplateId: floorData?.middleTemplateId,
880
879
  modularPackResult: {
881
880
  bundleUrl,
882
881
  taroVersion,
883
882
  },
884
883
  },
885
884
  });
886
885
  }
887
886
  return isUsable;
888
887
  const containerObj = containerList.find((item) => item.containerId === containerId);
889
888
  const blacklistModules = ['chatgroup'];
890
889
  return blacklistModules.includes(containerObj?.typeCode);
891
890
  const objContainer = containerListData.find((item) => item.containerId === containerId);
892
891
  return (
893
892
  objContainer?.includeUids?.some((itemUid) => {
894
893
  const objectFloor = floorListData.find((floorItem) => itemUid === floorItem.uid);
895
894
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag);
896
895
  }) ?? false
897
896
  );
898
897
  const unableIsvFloorListData = floorListData.filter(
899
898
  (floorItem) =>
900
899
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
901
900
  !isIsvFloorUseable(floorItem, exceptionReportFn),
902
901
  );
903
902
  const unableIsvFloorUidList = unableIsvFloorListData.map((floorItem) => floorItem.uid);
904
903
  const unableIsvContainerListData = containerListData.filter(
905
904
  (item) =>
906
905
  item.includeUids &&
907
906
  item.includeUids.every((itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1),
908
907
  );
909
908
  return unableIsvContainerListData;
910
909
  console.log('暂无对应渠道比较', compareVersion, nowVersion);
911
910
  return -2;
912
911
  return customObj;
913
912
  return customObj;
914
913
  return customObj;
915
914
  return customObj;
916
915
  return customObj;
917
916
  return customObj;
918
917
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
919
918
  let getParams = false;
920
919
  if (isOpenJdAppUrl(openAppUrl)) {
921
920
  try {
922
921
  getParams = openAppUrl.replace(/openApp\.jdMobile:\/\/virtual\?params=/i, '');
923
922
  getParams = JSON.parse(String(getParams));
924
923
  } catch (e) {
925
924
  console.log(e);
926
925
  }
927
926
  }
928
927
  return getParams;
929
928
  const getLastParams = Object.assign({}, openParams);
930
929
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
931
930
  if (val === null || val === '' || typeof val === 'undefined') {
932
931
  return true;
933
932
  }
934
933
  return false;
935
934
  const {
936
935
  moduleId = 'none',
937
936
  entrance = 'none',
938
937
  sourceType = 'none',
939
938
  sourceValue = 'none',
940
939
  } = params;
941
940
  if (isIosDevice) {
942
941
  return `${moduleId}#${entrance}`;
943
942
  } else if (isAndroidDevice) {
944
943
  return `${sourceType}#${sourceValue}`;
945
944
  }
946
945
  return 'none#none';
947
946
  if (data && typeof data === 'object') {
948
947
  let getOpenAppData = { ...data };
949
948
  try {
950
949
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
951
950
  if (designerId && templateId) {
952
951
  getOpenAppData = Object.assign({}, getOpenAppData, {
953
952
  sourceInfo: {
954
953
  entrance: '设计师预览',
955
954
  },
956
955
  });
957
956
  } else if (sourceInfo) {
958
957
  const { entrance } = sourceInfo;
959
958
  getOpenAppData.sourceInfo.entrance = entrance && entrance.length > 0 ? entrance : '其他';
960
959
  } else if (source && !sourceInfo) {
961
960
  if (typeof source === 'object') {
962
961
  const { sourceType, entrance, sourceValue, moduleId } = source;
963
962
  getOpenAppData = Object.assign({}, getOpenAppData, {
964
963
  sourceInfo: {
965
964
  entrance: sourceType || entrance || '其他',
966
965
  moduleId: sourceValue || moduleId || '-100',
967
966
  },
968
967
  });
969
968
  if (sourceType === 'shop_from_product_detail' && sourceValue) {
970
969
  getOpenAppData.sourceSku = sourceValue;
971
970
  }
972
971
  } else {
973
972
  getOpenAppData = Object.assign({}, getOpenAppData, {
974
973
  sourceInfo: {
975
974
  entrance: source,
976
975
  },
977
976
  });
978
977
  }
979
978
  } else {
980
979
  getOpenAppData = Object.assign({}, getOpenAppData, {
981
980
  sourceInfo: {
982
981
  entrance: '其他',
983
982
  },
984
983
  });
985
984
  }
986
985
  } catch (e) {
987
986
  console.log(e);
988
987
  }
989
988
  return getOpenAppData;
990
989
  }
991
990
  return data;
992
991
  return displayObj;
993
992
  if (typeof input === 'string') {
994
993
  try {
995
994
  return JSON.parse(input);
996
995
  } catch (e) {
997
996
  console.error('JSON解析失败', e);
998
997
  return {};
999
998
  }
1000
999
  }
1001
1000
  return input || {};
1002
1001
  return false;
1003
1002
  const borderStyle: { [key: string]: any } = {};
1004
1003
  if (item?.borderRadius) {
1005
1004
  let borderTopRadius = 0;
1006
1005
  let borderBottomRadius = 0;
1007
1006
  if (index === 0) {
1008
1007
  borderTopRadius = item.borderRadius;
1009
1008
  borderBottomRadius = floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0;
1010
1009
  } else if (index === floorDataLen - 1) {
1011
1010
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
1012
1011
  borderBottomRadius = item.borderRadius;
1013
1012
  } else {
1014
1013
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
1015
1014
  borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius;
1016
1015
  }
1017
1016
  borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
1018
1017
  ? `${item?.borderTopLeftRadius}px`
1019
1018
  : `${borderTopRadius}px`;
1020
1019
  borderStyle.borderTopRightRadius = item?.borderTopRightRadius
1021
1020
  ? `${item?.borderTopRightRadius}px`
1022
1021
  : `${borderTopRadius}px`;
1023
1022
  borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`;
1024
1023
  borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`;
1025
1024
  } else {
1026
1025
  borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
1027
1026
  borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
1028
1027
  borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
1029
1028
  borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
1030
1029
  }
1031
1030
  return borderStyle;
1032
1031
  return customObj;
1033
1032
  isJdApp,
1034
1033
  isWxApp,
1035
1034
  isIosDevice,
1036
1035
  isAndroidDevice,
1037
1036
  isJdAndIosDevice,
1038
1037
  isJdAndAndroidDevice,
1039
1038
  isWxMin,
1040
1039
  isWxMinAndWxapp,
1041
1040
  isJdMin,
1042
1041
  isMin,
1043
1042
  isJdMinAndHarmony,
1044
1043
  isH5,
1045
1044
  isDynamic,
1046
1045
  isH5AndJdShopView,
1047
1046
  isImageOptimizeEnable,
1048
1047
  isChartH5,
1049
1048
  isH5AndJdShopViewNativeScroll,
1050
1049
  isH5AndJdShopViewH5Scroll,
1051
1050
  isH5AndJdShopH5CustomScrollView,
1052
1051
  isWxMiniH5View,
1053
1052
  sliceArrToChunkList,
1054
1053
  dealAddress,
1055
1054
  objectToUrlEncode,
1056
1055
  parseQueryUrlString,
1057
1056
  setLowSmallPicUrl,
1058
1057
  getJfsImage,
1059
1058
  getQualityImage,
1060
1059
  countStringify,
1061
1060
  setTaroStorage,
1062
1061
  getTaroStorageKeyValue,
1063
1062
  removeTaroStorageKey,
1064
1063
  clearTaroStorageKey,
1065
1064
  getSystemInfos,
1066
1065
  addHttps,
1067
1066
  dateFormat,
1068
1067
  throttle,
1069
1068
  lodashThrottle,
1070
1069
  debounce,
1071
1070
  getTelephone,
1072
1071
  rgbToHex,
1073
1072
  hexToRgb,
1074
1073
  getRandom,
1075
1074
  getWxAppCookieStr,
1076
1075
  pxTransformFromData,
1077
1076
  dealShopContentData,
1078
1077
  showSuccessToast,
1079
1078
  showFailToast,
1080
1079
  showNormalToast,
1081
1080
  showShopLoading,
1082
1081
  hideShopLoading,
1083
1082
  getAppChannelType,
1084
1083
  formatTabActiveMenuType,
1085
1084
  filterUrlQueryData,
1086
1085
  getAvifSupport,
1087
1086
  getWebpSupport,
1088
1087
  isMemberPage,
1089
1088
  sgmCustomReport,
1090
1089
  draCustomReport,
1091
1090
  remoteCustomReport,
1092
1091
  draInterfaceCustomReport,
1093
1092
  draBusinessCustomReport,
1094
1093
  draBusinessCustomLogReport,
1095
1094
  isOpenJdAppUrl,
1096
1095
  jdOpenAppParams,
1097
1096
  createJdOpenAppUrl,
1098
1097
  dealJdOpenAppData,
1099
1098
  isEmpty,
1100
1099
  getJdAppReportPageSource,
1101
1100
  isAppClassifyPage,
1102
1101
  getQualityImageNew,
1103
1102
  getQualityImageOld,
1104
1103
  isPc,
1105
1104
  ipLoc_djd,
1106
1105
  jdAppVersionCompare,
1107
1106
  dealNativePixelToCssPixel,
1108
1107
  isAppStowShop,
1109
1108
  isIpadDevice,
1110
1109
  getBorderStyle,
1111
1110
  isLanguageForEn,
1112
1111
  sColor,
1113
1112
  draInterfaceDSMCustomReport,
1114
1113
  isTabletDevice,
1115
1114
  isInHarmonyBlacklistByModuleFlag,
1115
+ import Taro from '@tarojs/taro';
1116
1116
  SHOP_MENU_ID_TYPE,
1117
1117
  SHOP_MENU_ID_QUERY_NAME,
1118
1118
  SECTION_HOME_TAB_TYPE,
1119
1119
  SECTION_HOME_TAB_NAME_TYPE,
1120
1120
  SECTION_HOME_TAB_QUERY_TYPE,
1121
1121
  SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY,
1122
1122
  CHANNEL_TYPE,
1123
1123
  JDShopViewBusinessPathType,
1124
1124
  FloorModuleType,
1125
1125
  RemoteLoadFloorList,
1126
1126
  FLOOR_KIND,
1127
1127
  getBundleUrl,
1128
1128
  getBundleFileName,
1129
1129
  formatPackResult,
1130
1130
  getTaroVersion,
1131
1131
  /ipad/i.test(system) || (/android/i.test(system) && !/mobi|mini|fennec/i.test(system));
1132
1132
  key: string,
1133
1133
  value: string | object,
1134
1134
  successBack?: any,
1135
1135
  failBack?: any,
1136
1136
  try {
1137
1137
  if (isH5 && window && !window.localStorage) {
1138
1138
  console.log(`setTaroStorage key:${key} window.localStorage不存在:`);
1139
1139
  return Promise.resolve(null);
1140
1140
  }
1141
1141
  return Taro.setStorage({
1142
1142
  key: key,
1143
1143
  data: value,
1144
1144
  success: successBack,
1145
1145
  fail: failBack,
1146
1146
  }).catch((e) => {
1147
1147
  console.log(`setTaroStorage key:${key} 报错:`, e);
1148
1148
  return null;
1149
1149
  });
1150
1150
  } catch (e) {
1151
1151
  console.log(`setTaroStorage key:${key} 报错:`, e);
1152
1152
  return Promise.resolve(null);
1153
1153
  }
1154
1154
  try {
1155
1155
  if (isH5 && window && !window.localStorage) {
1156
1156
  console.log(`getTaroStorageKeyValue key:${key} window.localStorage不存在:`);
1157
1157
  return Promise.resolve(null);
1158
1158
  }
1159
1159
  return Taro.getStorageSync(key);
1160
1160
  } catch (e) {
1161
1161
  console.log(`getTaroStorageKeyValue key:${key} 报错:`, e);
1162
1162
  return null;
1163
1163
  }
1164
1164
  try {
1165
1165
  if (isH5 && window && !window.localStorage) {
1166
1166
  console.log(`removeTaroStorageKey key:${key} window.localStorage不存在:`);
1167
1167
  return Promise.resolve(null);
1168
1168
  }
1169
1169
  return Taro.removeStorage({
1170
1170
  key: key,
1171
1171
  }).catch((e) => {
1172
1172
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
1173
1173
  });
1174
1174
  } catch (e) {
1175
1175
  console.log(`removeTaroStorageKey key:${key} 报错:`, e);
1176
1176
  }
1177
1177
  try {
1178
1178
  if (isH5 && window && !window.localStorage) {
1179
1179
  console.log(`clearTaroStorageKey window.localStorage不存在`);
1180
1180
  return Promise.resolve(null);
1181
1181
  }
1182
1182
  return Taro.clearStorage().catch((e) => {
1183
1183
  console.log('clearTaroStorageKey报错:', e);
1184
1184
  });
1185
1185
  } catch (e) {
1186
1186
  console.log('clearTaroStorageKey报错:', e);
1187
1187
  }
1188
1188
  let hasChecked = false;
1189
1189
  if (isH5) {
1190
1190
  const avifCache = getTaroStorageKeyValue(KEY_AVIF);
1191
1191
  if (avifCache === null || avifCache === '' || forceUpdate) {
1192
1192
  hasChecked = true;
1193
1193
  const img = new Image();
1194
1194
  img.onload = function () {
1195
1195
  if (img.height > 0 && img.width > 0) {
1196
1196
  setTaroStorage(KEY_AVIF, '1');
1197
1197
  } else {
1198
1198
  setTaroStorage(KEY_AVIF, '0');
1199
1199
  }
1200
1200
  };
1201
1201
  img.onerror = () => {
1202
1202
  setTaroStorage(KEY_AVIF, '0');
1203
1203
  };
1204
1204
  img.src =
1205
1205
  'data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=';
1206
1206
  }
1207
1207
  const webpCache = getTaroStorageKeyValue(KEY_WEBP);
1208
1208
  if (webpCache === null || webpCache === '' || forceUpdate) {
1209
1209
  hasChecked = true;
1210
1210
  const img = new Image();
1211
1211
  img.onload = function () {
1212
1212
  if (img.height > 0 && img.width > 0) {
1213
1213
  setTaroStorage(KEY_WEBP, '1');
1214
1214
  } else {
1215
1215
  setTaroStorage(KEY_WEBP, '0');
1216
1216
  }
1217
1217
  };
1218
1218
  img.onerror = () => {
1219
1219
  setTaroStorage(KEY_WEBP, '0');
1220
1220
  };
1221
1221
  img.src =
1222
1222
  'data:image/webp;base64,UklGRiQAAABXRUJQVlA4IBgAAAAwAQCdASoBAAEAAUAmJaQAA3AA/vz0AAA=';
1223
1223
  }
1224
1224
  }
1225
1225
  return hasChecked;
1226
1226
  const hasChecked = imageFormatSupport(false);
1227
1227
  if (!hasChecked) {
1228
1228
  setTimeout(imageFormatSupport, 5000);
1229
1229
  }
1230
1230
  const resultList: Array<any> = [],
1231
1231
  arrLen = arr.length;
1232
1232
  if (arrLen) {
1233
1233
  if (arrLen > size) {
1234
1234
  for (let i = 0; i < arrLen; i = i + size) {
1235
1235
  resultList.push(arr.slice(i, i + size));
1236
1236
  }
1237
1237
  } else {
1238
1238
  resultList.push(arr);
1239
1239
  }
1240
1240
  }
1241
1241
  return resultList;
1242
1242
  let _address = ids;
1243
1243
  const _areaAreaSplit = ids.split('.');
1244
1244
  const _areaAreaSplit2 = ids.split('_');
1245
1245
  _address = _areaAreaSplit.length === 2 ? _areaAreaSplit[0] : _address;
1246
1246
  _address = _areaAreaSplit2.length === 3 ? `${_areaAreaSplit2}_0` : _address;
1247
1247
  return _address;
1248
1248
  let paramStr = '';
1249
1249
  obj &&
1250
1250
  Object.keys(obj).forEach((key, index) => {
1251
1251
  const getValue = `${obj[key]}`.replace(/undefined/, '').replace(/null/, '');
1252
1252
  paramStr += `${index === 0 ? '' : '&'}${key}=${encodeURIComponent(getValue)}`;
1253
1253
  });
1254
1254
  return paramStr;
1255
1255
  const result = {};
1256
1256
  if (
1257
1257
  !urlOrQueryStr ||
1258
1258
  ('string' !== typeof urlOrQueryStr && String !== urlOrQueryStr.constructor)
1259
1259
  ) {
1260
1260
  return result;
1261
1261
  }
1262
1262
  if (urlOrQueryStr && urlOrQueryStr.indexOf('channelSource=appShop') > -1) {
1263
1263
  result['channelSource'] = 'appShop';
1264
1264
  }
1265
1265
  if (urlOrQueryStr.indexOf('?') > -1) {
1266
1266
  const queryStr = urlOrQueryStr.split('?');
1267
1267
  const queryItemList = queryStr && queryStr.length > 1 ? queryStr[1].split('&') : [];
1268
1268
  const queryItemListLen = queryItemList.length;
1269
1269
  queryItemListLen > 0 &&
1270
1270
  queryItemList.forEach((item) => {
1271
1271
  const thisItemList = item.split('=');
1272
1272
  result[thisItemList[0]] = thisItemList[1];
1273
1273
  });
1274
1274
  } else {
1275
1275
  const queryItemList =
1276
1276
  urlOrQueryStr.indexOf('&') > -1 ? urlOrQueryStr.split('&') : [urlOrQueryStr];
1277
1277
  const queryItemListLen = queryItemList.length;
1278
1278
  queryItemListLen > 0 &&
1279
1279
  queryItemList.forEach((item) => {
1280
1280
  const thisItemList = item.split('=');
1281
1281
  result[thisItemList[0]] = thisItemList[1];
1282
1282
  });
1283
1283
  }
1284
1284
  return result;
1285
1285
  url: string,
1286
1286
  size?: {
1287
1287
  w: number;
1288
1288
  h: number;
1289
1289
  },
1290
1290
  quality?: number,
1291
1291
  if (url && size) {
1292
1292
  const _w = Math.floor(size.w);
1293
1293
  const _h = Math.floor(size.h);
1294
1294
  if (url.match(/gif$/i)) {
1295
1295
  return url;
1296
1296
  } else {
1297
1297
  if (_w > 0 && _h > 0) {
1298
1298
  url = url.replace('jfs/', `s${_w}x${_h}_jfs/`);
1299
1299
  }
1300
1300
  url += quality != null ? `!q${quality}.dpg` : '.dpg';
1301
1301
  }
1302
1302
  }
1303
1303
  return url;
1304
1304
  if (url.match(/\.(jpg|png|dpg)$/i)) {
1305
1305
  const { width, height, quality } = jfsImgInfo;
1306
1306
  if (typeof width === 'number' || typeof height === 'number') {
1307
1307
  url = url.replace('/jfs/', `/s${Math.floor(width || 0)}x${Math.floor(height || 0)}_jfs/`);
1308
1308
  }
1309
1309
  if (typeof quality === 'number' && quality > 0 && quality < 100 && url.match(/\.jpg$/i)) {
1310
1310
  url += `!q${quality}.dpg`;
1311
1311
  }
1312
1312
  }
1313
1313
  return addHttps(url);
1314
1314
  if (imgUrl) {
1315
1315
  if (
1316
1316
  !imgUrl.match(
1317
1317
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|(imgcps\.jd\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
1318
1318
  )
1319
1319
  ) {
1320
1320
  if (!imgUrl.includes('360buyimg.com')) {
1321
1321
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1322
1322
  }
1323
1323
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
1324
1324
  }
1325
1325
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1326
1326
  }
1327
1327
  return imgUrl;
1328
1328
  const result = value % step;
1329
1329
  return result === 0 ? value : Math.ceil(value / step) * step;
1330
1330
  const MAX = 3.5;
1331
1331
  return Math.min(window?.devicePixelRatio ?? 2, MAX);
1332
1332
  isSkuImage: boolean;
1333
1333
  size: number;
1334
1334
  sizeScale: number;
1335
1335
  imgUrl: string,
1336
1336
  options: QualityOptions,
1337
1337
  isIgnoreOptimizeFromServer: boolean = false,
1338
1338
  if (!imgUrl) {
1339
1339
  console.error('The input parameter imageUrl for the getQualityImage() cannot be empty!');
1340
1340
  return imgUrl;
1341
1341
  }
1342
1342
  if (isIgnoreOptimizeFromServer) {
1343
1343
  imgUrl = imgUrl.replace(/\.(jpe?g|png).*/, '.$1');
1344
1344
  }
1345
1345
  if (!/^((https?):)?\/\//.test(imgUrl)) {
1346
1346
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1347
1347
  }
1348
1348
  const imgServerRegExp = /(img|m)\d{0,2}\.360buyimg\.com\/.*\.(jpe?g|png)/i;
1349
1349
  if (!imgServerRegExp.test(imgUrl)) {
1350
1350
  return imgUrl;
1351
1351
  }
1352
1352
  imgUrl = /^\/\//.test(imgUrl) ? `https:${imgUrl}` : imgUrl;
1353
1353
  const { isSkuImage, size, sizeScale = 1 } = options || {};
1354
1354
  const getSizeScale = Number(sizeScale);
1355
1355
  const needReduceSize = isSkuImage && size;
1356
1356
  if (needReduceSize) {
1357
1357
  const devicePixelRatio = getDevicePixelRatio();
1358
1358
  const useWidth = getValueByStep(size * devicePixelRatio, 40);
1359
1359
  const useHeight =
1360
1360
  getSizeScale > 0 && getSizeScale !== 1 ? Math.round(useWidth * Number(sizeScale)) : useWidth;
1361
1361
  imgUrl = imgUrl.replace(/\/[^\/]*jfs\//, `/s${useWidth}x${useHeight}_jfs/`);
1362
1362
  }
1363
1363
  const needCompress = !global?.info?.pageInfo?.isVipShop;
1364
1364
  const result = imgUrl.match(/\/\w+\.(jpe?g|png)$/);
1365
1365
  if (needCompress && result) {
1366
1366
  if (getAvifSupport() === '1') {
1367
1367
  imgUrl += '.avif';
1368
1368
  } else if (getWebpSupport() === '1') {
1369
1369
  imgUrl += '.webp';
1370
1370
  } else if (/jpe?g/.test(result[1])) {
1371
1371
  imgUrl += '!q80';
1372
1372
  }
1373
1373
  }
1374
1374
  if (needReduceSize) {
1375
1375
  imgUrl += '!z2';
1376
1376
  }
1377
1377
  return imgUrl;
1378
1378
  if (imgUrl) {
1379
1379
  if (
1380
1380
  !imgUrl.match(
1381
1381
  /(storage\.360buyimg\.com)|(jdcloud-oss\.com)|((\w+)\.300hu\.com)|(thirdwx\.qlogo\.cn)|(!q)|gif|dpg$/i,
1382
1382
  )
1383
1383
  ) {
1384
1384
  if (!imgUrl.includes('360buyimg.com')) {
1385
1385
  imgUrl = '//m.360buyimg.com/cms/' + imgUrl;
1386
1386
  }
1387
1387
  if (quality != 100) imgUrl += /\.png/.test(imgUrl) ? '.dpg' : `!q${quality}`;
1388
1388
  }
1389
1389
  imgUrl = imgUrl.match(/^\/\//) ? `https:${imgUrl}` : imgUrl;
1390
1390
  }
1391
1391
  return imgUrl;
1392
1392
  return getTaroStorageKeyValue(KEY_AVIF) || '0';
1393
1393
  return getTaroStorageKeyValue(KEY_WEBP) || '0';
1394
1394
  count: number,
1395
1395
  fixedNum = 1,
1396
1396
  unit = '万',
1397
1397
  maxNum = 10000,
1398
1398
  count = Number(count);
1399
1399
  const getMaxNum = count > 100000000 ? 100000000 : maxNum;
1400
1400
  const getUnit = count > 100000000 ? '亿' : unit;
1401
1401
  if (count >= getMaxNum) {
1402
1402
  return (count / getMaxNum).toFixed(fixedNum) + getUnit;
1403
1403
  }
1404
1404
  return count;
1405
1405
  const systemInfo: UtilsInterFace.taroGetSystemInfoSyncRes = getSystemInfo || {
1406
1406
  platform: '',
1407
1407
  model: '',
1408
1408
  system: '',
1409
1409
  };
1410
1410
  const isIOS = !!systemInfo.system.match(/ios/i);
1411
1411
  const isAndroid = !!systemInfo.system.match(/android/i);
1412
1412
  if (!systemInfo.statusBarHeight) {
1413
1413
  systemInfo.statusBarHeight = screenHeight - windowHeight - 20;
1414
1414
  systemInfo.navBarExtendHeight = 0;
1415
1415
  } else {
1416
1416
  if (isIOS) {
1417
1417
  systemInfo.navBarExtendHeight = 4;
1418
1418
  } else {
1419
1419
  systemInfo.navBarExtendHeight = 0;
1420
1420
  }
1421
1421
  }
1422
1422
  let rect = Taro.getMenuButtonBoundingClientRect ? Taro.getMenuButtonBoundingClientRect() : null;
1423
1423
  if (!rect || !rect.width || !rect.top || !rect.left || !rect.height) {
1424
1424
  let gap = 0;
1425
1425
  let width = 96;
1426
1426
  if (systemInfo.platform === 'android') {
1427
1427
  gap = 8;
1428
1428
  width = 96;
1429
1429
  } else if (systemInfo.platform === 'devtools') {
1430
1430
  if (isIOS) {
1431
1431
  gap = 5.5;
1432
1432
  } else {
1433
1433
  gap = 7.5;
1434
1434
  }
1435
1435
  } else {
1436
1436
  gap = 4;
1437
1437
  width = 88;
1438
1438
  }
1439
1439
  rect = {
1440
1440
  bottom: systemInfo.statusBarHeight + gap + 32,
1441
1441
  height: 32,
1442
1442
  left: systemInfo.windowWidth - width - 10,
1443
1443
  right: systemInfo.windowWidth - 10,
1444
1444
  top: systemInfo.statusBarHeight + gap,
1445
1445
  width,
1446
1446
  };
1447
1447
  }
1448
1448
  const gap = rect.top - systemInfo.statusBarHeight;
1449
1449
  systemInfo.navBarTopToStatusBar = gap;
1450
1450
  systemInfo.navBarHeight = 2 * gap + rect.height;
1451
1451
  systemInfo.capsulePosition = rect;
1452
1452
  systemInfo.isIOS = isIOS;
1453
1453
  systemInfo.isAndroid = isAndroid;
1454
1454
  return systemInfo;
1455
1455
  if (str.match(/^\/\//)) {
1456
1456
  str = 'https:' + str;
1457
1457
  }
1458
1458
  return str;
1459
1459
  dateTimeOrdate: Date | string | number | null,
1460
1460
  format = 'yyyy-MM-dd HH:mm:ss',
1461
1461
  noPadStart = {
1462
1462
  M: '0',
1463
1463
  d: '0',
1464
1464
  H: '0',
1465
1465
  m: '0',
1466
1466
  s: '0',
1467
1467
  },
1468
1468
  let dateResult = '';
1469
1469
  const padStarts = Object.assign(
1470
1470
  {
1471
1471
  M: '0',
1472
1472
  d: '0',
1473
1473
  H: '0',
1474
1474
  m: '0',
1475
1475
  s: '0',
1476
1476
  },
1477
1477
  noPadStart,
1478
1478
  );
1479
1479
  if (dateTimeOrdate) {
1480
1480
  let changeDateTimeOrdate = dateTimeOrdate;
1481
1481
  const getChangeDateTimeToNumber = Number(changeDateTimeOrdate);
1482
1482
  if (getChangeDateTimeToNumber) {
1483
1483
  changeDateTimeOrdate = getChangeDateTimeToNumber;
1484
1484
  } else {
1485
1485
  changeDateTimeOrdate = `${changeDateTimeOrdate}`.replace(/-/g, '/').replace(/\./g, '/');
1486
1486
  }
1487
1487
  const nowDate =
1488
1488
  dateTimeOrdate instanceof Date ? dateTimeOrdate : new Date(changeDateTimeOrdate);
1489
1489
  const dateMap = {
1490
1490
  y: `${nowDate.getFullYear()}`,
1491
1491
  M: `${nowDate.getMonth() + 1}`.padStart(2, padStarts['M']),
1492
1492
  d: `${nowDate.getDate()}`.padStart(2, padStarts['d']),
1493
1493
  H: `${nowDate.getHours()}`.padStart(2, padStarts['H']),
1494
1494
  m: `${nowDate.getMinutes()}`.padStart(2, padStarts['m']),
1495
1495
  s: `${nowDate.getSeconds()}`.padStart(2, padStarts['s']),
1496
1496
  };
1497
1497
  const regDate = new RegExp('y+|M+|d+|H+|m+|s+', 'g');
1498
1498
  const regYear = new RegExp('y');
1499
1499
  dateResult = format.replace(regDate, (v) => {
1500
1500
  let changeValue = v;
1501
1501
  if (regYear.test(changeValue)) {
1502
1502
  const thisYear = dateMap.y;
1503
1503
  const subValueLen = 4 - changeValue.length;
1504
1504
  changeValue = thisYear.substr(subValueLen);
1505
1505
  } else {
1506
1506
  const dateKey = v.substr(0, 1);
1507
1507
  changeValue = dateMap[dateKey];
1508
1508
  }
1509
1509
  return changeValue;
1510
1510
  });
1511
1511
  }
1512
1512
  return dateResult;
1513
1513
  let timer: any = null;
1514
1514
  let startTime = Date.now();
1515
1515
  return function () {
1516
1516
  const curTime = Date.now();
1517
1517
  const remaining = delay - (curTime - startTime);
1518
1518
  const context = this;
1519
1519
  const args = arguments;
1520
1520
  clearTimeout(timer);
1521
1521
  if (remaining <= 0) {
1522
1522
  func.apply(context, args);
1523
1523
  startTime = Date.now();
1524
1524
  } else {
1525
1525
  timer = setTimeout(func, remaining);
1526
1526
  }
1527
1527
  };
1528
1528
  let context, args, result;
1529
1529
  let timeout = null;
1530
1530
  let previous = 0;
1531
1531
  if (!options) options = {};
1532
1532
  const later = function () {
1533
1533
  previous = options.leading === false ? 0 : Date.now();
1534
1534
  timeout = null;
1535
1535
  result = func.apply(context, args);
1536
1536
  if (!timeout) context = args = null;
1537
1537
  };
1538
1538
  return function () {
1539
1539
  const now = Date.now();
1540
1540
  if (!previous && options.leading === false) previous = now;
1541
1541
  const remaining = wait - (now - previous);
1542
1542
  context = this;
1543
1543
  args = arguments;
1544
1544
  if (remaining <= 0 || remaining > wait) {
1545
1545
  if (timeout) {
1546
1546
  clearTimeout(timeout);
1547
1547
  timeout = null;
1548
1548
  }
1549
1549
  previous = now;
1550
1550
  result = func.apply(context, args);
1551
1551
  if (!timeout) context = args = null;
1552
1552
  } else if (!timeout && options.trailing !== false) {
1553
1553
  timeout = setTimeout(later, remaining);
1554
1554
  }
1555
1555
  return result;
1556
1556
  };
1557
1557
  let timer: any = null;
1558
1558
  return function () {
1559
1559
  const context: any = this;
1560
1560
  const args = arguments;
1561
1561
  timer && clearTimeout(timer);
1562
1562
  timer = setTimeout(function () {
1563
1563
  fn.apply(context, args);
1564
1564
  }, delay);
1565
1565
  };
1566
1566
  if (txt) {
1567
1567
  txt = txt.trim();
1568
1568
  const reg = new RegExp(/[\d-]+/);
1569
1569
  const res = reg.exec(txt);
1570
1570
  if (res && res.length > 0) {
1571
1571
  let tel = res[0];
1572
1572
  if (tel && delSeparator) {
1573
1573
  tel = tel.replace(/-/g, '');
1574
1574
  }
1575
1575
  return tel;
1576
1576
  }
1577
1577
  }
1578
1578
  return '';
1579
1579
  if (rgb) {
1580
1580
  const reg = /^(rgb|RGB)/;
1581
1581
  const color = rgb;
1582
1582
  if (reg.test(color)) {
1583
1583
  let strHex = '#';
1584
1584
  const colorArr = color.replace(/(?:\(|\)|rgb|RGB)*/g, '').split(',');
1585
1585
  for (let i = 0; i < colorArr.length; i++) {
1586
1586
  let hex = Number(colorArr[i]).toString(16);
1587
1587
  if (hex === '0') {
1588
1588
  hex += hex;
1589
1589
  }
1590
1590
  strHex += hex;
1591
1591
  }
1592
1592
  return strHex;
1593
1593
  } else {
1594
1594
  return String(color);
1595
1595
  }
1596
1596
  } else {
1597
1597
  return '';
1598
1598
  }
1599
1599
  if (hex) {
1600
1600
  const reg = /^#([0-9a-fA-f]{3}|[0-9a-fA-f]{6})$/;
1601
1601
  let color = hex.toLowerCase();
1602
1602
  if (reg.test(color)) {
1603
1603
  if (color.length === 4) {
1604
1604
  let colorNew = '#';
1605
1605
  for (let i = 1; i < 4; i += 1) {
1606
1606
  colorNew += color.slice(i, i + 1).concat(color.slice(i, i + 1));
1607
1607
  }
1608
1608
  color = colorNew;
1609
1609
  }
1610
1610
  const colorChange: number[] = [];
1611
1611
  for (let i = 1; i < 7; i += 2) {
1612
1612
  colorChange.push(parseInt('0x' + color.slice(i, i + 2)));
1613
1613
  }
1614
1614
  if (returnList) {
1615
1615
  return colorChange;
1616
1616
  } else {
1617
1617
  return 'RGB(' + colorChange.join(',') + ')';
1618
1618
  }
1619
1619
  } else {
1620
1620
  return color;
1621
1621
  }
1622
1622
  } else {
1623
1623
  return '';
1624
1624
  }
1625
1625
  const c = m - n + 1;
1626
1626
  const res = Math.floor(Math.random() * c + n);
1627
1627
  if (filterNum && filterNum == res) {
1628
1628
  console.log('随机数二次开始', res, filterNum);
1629
1629
  return getRandom(n, m, filterNum);
1630
1630
  } else {
1631
1631
  return res;
1632
1632
  }
1633
1633
  wqCookieStr: string;
1634
1634
  wqCookie: {
1635
1635
  pin?: string;
1636
1636
  visitkey?: string;
1637
1637
  [key: string]: any;
1638
1638
  };
1639
1639
 
1640
1640
  const {
1641
1641
  jdpin,
1642
1642
  pinStatus,
1643
1643
  visitkey,
1644
1644
  unionid,
1645
1645
  skey,
1646
1646
  __jda,
1647
1647
  __jdv,
1648
1648
  __wga,
1649
1649
  wid,
1650
1650
  wq_skey,
1651
1651
  wq_uin,
1652
1652
  wq_auth_token,
1653
1653
  wxapp_scene,
1654
1654
  wq_unionid,
1655
1655
  wxapp_openid,
1656
1656
  wxapp_version,
1657
1657
  wxapp_type,
1658
1658
  appType,
1659
1659
  lbs_addr,
1660
1660
  pt_key,
1661
1661
  pt_pin,
1662
1662
  } = cookie;
1663
1663
  const ret: string[] = [];
1664
1664
  const getUserCookieObj = {};
1665
1665
  const createUseCookieArr = [
1666
1666
  jdpin,
1667
1667
  pinStatus,
1668
1668
  visitkey,
1669
1669
  unionid,
1670
1670
  skey,
1671
1671
  __jda,
1672
1672
  __jdv,
1673
1673
  __wga,
1674
1674
  wid,
1675
1675
  wq_skey,
1676
1676
  wq_uin,
1677
1677
  wq_auth_token,
1678
1678
  wxapp_scene,
1679
1679
  wq_unionid,
1680
1680
  wxapp_openid,
1681
1681
  wxapp_version,
1682
1682
  wxapp_type,
1683
1683
  appType,
1684
1684
  lbs_addr,
1685
1685
  pt_key,
1686
1686
  pt_pin,
1687
1687
  ];
1688
1688
 
1689
1689
  createUseCookieArr.forEach((keyItem) => {
1690
1690
  if (keyItem && keyItem['name']) {
1691
1691
  let { name, value } = keyItem;
1692
1692
  name = name === 'jdpin' ? 'pin' : name;
1693
1693
  name === 'pin' && value && ret.push(`pt_pin=${encodeURIComponent(value)}`);
1694
1694
  ret.push(`${name}=${encodeURIComponent(value)}`);
1695
1695
  getUserCookieObj[name] = value;
1696
1696
  }
1697
1697
  });
1698
1698
  return {
1699
1699
  wqCookieStr: ret.join(';'),
1700
1700
  wqCookie: getUserCookieObj,
1701
1701
  };
1702
1702
  const getLayoutWidth = layoutWidth || global.info?.sysInfo?.windowWidth || windowWidth;
1703
1703
  const getNum = Number(num);
1704
1704
  return Math.round((getNum / widthSize) * getLayoutWidth);
1705
1705
  let checkState = false;
1706
1706
  const couponFloorModuleType = floorData?.floorExtInfo?.moduleFlag;
1707
1707
  if (couponFloorModuleType === FloorModuleType.COUPON) {
1708
1708
  try {
1709
1709
  const dataDefines = getFloorDataToDataDefines(floorData);
1710
1710
  const couponDataDefine = dataDefines
1711
1711
  ? dataDefines.filter((item) => {
1712
1712
  return item.type === 'coupon';
1713
1713
  })
1714
1714
  : [],
1715
1715
  couponList = couponDataDefine[0]?.nodeText?.data ? couponDataDefine[0]?.nodeText?.data : [],
1716
1716
  couponLength = couponList.length,
1717
1717
  numShowPerLine = couponDataDefine[0]?.nodeText?.numShowPerLine
1718
1718
  ? couponDataDefine[0]?.nodeText?.numShowPerLine
1719
1719
  : 0;
1720
1720
  if (numShowPerLine === 0 && couponLength > 3) {
1721
1721
  checkState = true;
1722
1722
  }
1723
1723
  } catch (e) {
1724
1724
  checkState = false;
1725
1725
  }
1726
1726
  return checkState;
1727
1727
  }
1728
1728
  const {
1729
1729
  containers = [],
1730
1730
  floors = [],
1731
1731
  homeExtInfo = {},
1732
1732
  clearFirstContaierMarginTop = false,
1733
1733
  } = pageData;
1734
1734
  console.log('dealShopContentData:', pageData, 'isvdev:', isvdev, 'homeExtInfo:', homeExtInfo);
1735
1735
  const getThisTimeKey = Date.now();
1736
1736
  let shopContentContainerListData = containers?.filter(
1737
1737
  (item) => (!isvdev && item.typeCode !== 'mShopHeader') || isvdev,
1738
1738
  );
1739
1739
  const shopContentFloorListData = floors?.filter(
1740
1740
  ({ floorPosition }) =>
1741
1741
  (!isvdev && floorPosition !== 'header' && floorPosition !== 'footer') || isvdev,
1742
1742
  );
1743
1743
  const unableIsvContainerListData = getUnableIsvContainerListData(
1744
1744
  shopContentFloorListData,
1745
1745
  shopContentContainerListData,
1746
1746
  exceptionReportFn,
1747
1747
  );
1748
1748
  shopContentContainerListData.forEach((item, index) => {
1749
1749
  item.key = `${getThisTimeKey + index}`;
1750
1750
  item.floors = [];
1751
1751
  item.includeUids &&
1752
1752
  item.includeUids.forEach((floorUid) => {
1753
1753
  const getFloorData = shopContentFloorListData.find(
1754
1754
  (floorItem) => floorItem.uid === floorUid,
1755
1755
  );
1756
1756
  if (getFloorData) {
1757
1757
  const changeFloorData = {
1758
1758
  containerId: item.containerId,
1759
1759
  containerIndex: index,
1760
1760
  ...getFloorData,
1761
1761
  };
1762
1762
  if (homeExtInfo?.pageThemColorType) {
1763
1763
  changeFloorData.pageThemColorType = homeExtInfo.pageThemColorType;
1764
1764
  }
1765
1765
  const getCheckMoreCouponState = checkCouponAndChangeContainerSetData(getFloorData);
1766
1766
  if (getCheckMoreCouponState) {
1767
1767
  item.marginLeft && (item.marginLeft = 0);
1768
1768
  item.marginRight && (item.marginRight = 0);
1769
1769
  item.borderRadius && (item.borderRadius = 0);
1770
1770
  }
1771
1771
  if (getFloorData?.floorExtInfo?.floorLoadWay === 2) {
1772
1772
  const getSysFloorToLoadTypeRes = isIsvFloorUseable(getFloorData, exceptionReportFn);
1773
1773
  !getSysFloorToLoadTypeRes && (getFloorData.floorExtInfo.floorLoadWay = 1);
1774
1774
  }
1775
1775
  item.floors.push(changeFloorData);
1776
1776
  }
1777
1777
  });
1778
1778
  if (
1779
1779
  ((!isvdev && index === 0) || (isvdev && index === 1)) &&
1780
1780
  item?.containerPosition == 'content' &&
1781
1781
  item?.marginBottom > 0 &&
1782
1782
  !clearFirstContaierMarginTop
1783
1783
  ) {
1784
1784
  item.marginTop = item.marginBottom;
1785
1785
  }
1786
1786
  });
1787
1787
  shopContentContainerListData = shopContentContainerListData.filter(
1788
1788
  (item) =>
1789
1789
  item.floors.length > 0 &&
1790
1790
  unableIsvContainerListData.every(
1791
1791
  (containerItem) => containerItem.containerId != item.containerId,
1792
1792
  ),
1793
1793
  );
1794
1794
  console.log(
1795
1795
  'dealShopContentData isWxMinAndWxapp:',
1796
1796
  isWxMinAndWxapp,
1797
1797
  'weappJumpToH5:',
1798
1798
  pageData?.homeExtInfo?.weappJumpToH5,
1799
1799
  );
1800
1800
  if (isProd && isWxMinAndWxapp) {
1801
1801
  shopContentContainerListData = shopContentContainerListData.filter(
1802
1802
  (item) =>
1803
1803
  item.floors.length > 0 &&
1804
1804
  !isIsvContainer(item.containerId, shopContentFloorListData, shopContentContainerListData),
1805
1805
  );
1806
1806
  }
1807
1807
  shopContentContainerListData = [].concat(shopContentContainerListData);
1808
1808
  return {
1809
1809
  shopContentContainerListData,
1810
1810
  shopContentFloorListData,
1811
1811
  };
1812
1812
  const changeOpts = {
1813
1813
  title: '',
1814
1814
  icon: 'success',
1815
1815
  duration: 1500,
1816
1816
  mask: true,
1817
1817
  ...options,
1818
1818
  };
1819
1819
  if (changeOpts.title.length > 7) {
1820
1820
  showNormalToast(options);
1821
1821
  } else {
1822
1822
  Taro.showToast(changeOpts as any);
1823
1823
  }
1824
1824
  const changeOpts = {
1825
1825
  title: '',
1826
1826
  icon: 'error',
1827
1827
  duration: 1500,
1828
1828
  mask: true,
1829
1829
  ...options,
1830
1830
  };
1831
1831
  if (changeOpts.title.length > 7) {
1832
1832
  showNormalToast(options);
1833
1833
  } else {
1834
1834
  Taro.showToast(changeOpts as any);
1835
1835
  }
1836
1836
  Taro.showToast({
1837
1837
  title: '',
1838
1838
  icon: 'none',
1839
1839
  duration: 1500,
1840
1840
  mask: true,
1841
1841
  ...options,
1842
1842
  });
1843
1843
  return Taro.showLoading({
1844
1844
  title: text,
1845
1845
  });
1846
1846
  return new Promise(() => {
1847
1847
  Taro.nextTick(() => {
1848
1848
  setTimeout(() => {
1849
1849
  Taro.hideLoading(options);
1850
1850
  }, 300);
1851
1851
  });
1852
1852
  });
1853
1853
  return CHANNEL_TYPE[JDShopViewBusinessPathType.HOME];
1854
1854
  const {
1855
1855
  tabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN],
1856
1856
  sceneId,
1857
1857
  currentTabType,
1858
1858
  } = query;
1859
1859
  let changeTabActive = tabActive;
1860
1860
  if (sceneId) {
1861
1861
  if (isH5) {
1862
1862
  if (sceneId == '1002') {
1863
1863
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1864
1864
  }
1865
1865
  else if (sceneId == '1003') {
1866
1866
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_ACTIVITY];
1867
1867
  }
1868
1868
  } else if (isWxMinAndWxapp) {
1869
1869
  if (sceneId == '1001' || sceneId == '1002') {
1870
1870
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PRODUCT];
1871
1871
  }
1872
1872
  else if (sceneId == '1003') {
1873
1873
  changeTabActive = SECTION_HOME_TAB_NAME_TYPE[SECTION_HOME_TAB_TYPE.HOME_PROMOTION];
1874
1874
  }
1875
1875
  }
1876
1876
  }
1877
1877
  if (SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]) {
1878
1878
  if (
1879
1879
  !isNaN(currentTabType) &&
1880
1880
  SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(currentTabType) !== -1
1881
1881
  ) {
1882
1882
  return {
1883
1883
  menuType: SHOP_MENU_ID_TYPE.HOME,
1884
1884
  tabActiveType: currentTabType,
1885
1885
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${currentTabType}`,
1886
1886
  };
1887
1887
  }
1888
1888
  return {
1889
1889
  menuType: SHOP_MENU_ID_TYPE.HOME,
1890
1890
  tabActiveType: SECTION_HOME_TAB_QUERY_TYPE[changeTabActive],
1891
1891
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_QUERY_TYPE[changeTabActive]}`,
1892
1892
  };
1893
1893
  } else if (SHOP_MENU_ID_QUERY_NAME[changeTabActive]) {
1894
1894
  return {
1895
1895
  menuType: SHOP_MENU_ID_QUERY_NAME[changeTabActive],
1896
1896
  tabActiveType: 0,
1897
1897
  queryMenuTabActiveStr: `${SHOP_MENU_ID_QUERY_NAME[changeTabActive]}@0`,
1898
1898
  };
1899
1899
  } else {
1900
1900
  const defaultMenuType = {
1901
1901
  menuType: SHOP_MENU_ID_TYPE.HOME,
1902
1902
  tabActiveType: SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN,
1903
1903
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${SECTION_HOME_TAB_TYPE.HOME_WELL_CHOSEN}`,
1904
1904
  };
1905
1905
  const isCustomTab = tabActive.indexOf(SECTION_HOME_TAB_NAME_TYPE.HOME_CUSTOM) !== -1;
1906
1906
  if (isCustomTab) {
1907
1907
  const customTabType = Number(tabActive.split('-')[2]);
1908
1908
  if (
1909
1909
  !isNaN(customTabType) &&
1910
1910
  SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(customTabType) !== -1
1911
1911
  ) {
1912
1912
  return {
1913
1913
  menuType: SHOP_MENU_ID_TYPE.HOME,
1914
1914
  tabActiveType: customTabType,
1915
1915
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${customTabType}`,
1916
1916
  };
1917
1917
  } else {
1918
1918
  return defaultMenuType;
1919
1919
  }
1920
1920
  } else {
1921
1921
  if (
1922
1922
  !isNaN(currentTabType) &&
1923
1923
  SECTION_HOME_CUSTOM_TAB_TYPE_ARRAY.indexOf(currentTabType) !== -1
1924
1924
  ) {
1925
1925
  return {
1926
1926
  menuType: SHOP_MENU_ID_TYPE.HOME,
1927
1927
  tabActiveType: currentTabType,
1928
1928
  queryMenuTabActiveStr: `${SHOP_MENU_ID_TYPE.HOME}@${currentTabType}`,
1929
1929
  };
1930
1930
  }
1931
1931
  return defaultMenuType;
1932
1932
  }
1933
1933
  }
1934
1934
  const deleteKeyList = [
1935
1935
  '$taroTimestamp',
1936
1936
  'cookie',
1937
1937
  'wdref',
1938
1938
  'navStart',
1939
1939
  'originOpts',
1940
1940
  'originParams',
1941
1941
  'originUrl',
1942
1942
  'referer',
1943
1943
  'stamp',
1944
1944
  'hybrid',
1945
1945
  'sr',
1946
1946
  'navh',
1947
1947
  'stath',
1948
1948
  ];
1949
1949
  let changeQueryData: any = { ...queryData };
1950
1950
  const qrCodeScene = changeQueryData?.scene ? changeQueryData?.scene : false;
1951
1951
  const sceneQuery =
1952
1952
  qrCodeScene && typeof qrCodeScene === 'string'
1953
1953
  ? parseQueryUrlString(decodeURIComponent(qrCodeScene))
1954
1954
  : {};
1955
1955
  changeQueryData = { ...changeQueryData, ...sceneQuery };
1956
1956
  deleteKeyList.forEach((key) => {
1957
1957
  changeQueryData[key] && delete changeQueryData[key];
1958
1958
  });
1959
1959
  Object.keys(changeQueryData).forEach((key) => {
1960
1960
  if (changeQueryData[key] && Array.isArray(changeQueryData[key])) {
1961
1961
  changeQueryData[key] = changeQueryData[key][0] || '';
1962
1962
  }
1963
1963
  });
1964
1964
  changeQueryData['shopid'] &&
1965
1965
  (changeQueryData['shopId'] = changeQueryData['shopid']) &&
1966
1966
  delete changeQueryData['shopid'];
1967
1967
  changeQueryData['venderid'] &&
1968
1968
  (changeQueryData['venderId'] = changeQueryData['venderid']) &&
1969
1969
  delete changeQueryData['venderid'];
1970
1970
  changeQueryData['vendorId'] &&
1971
1971
  (changeQueryData['venderId'] = changeQueryData['vendorId']) &&
1972
1972
  delete changeQueryData['vendorId'];
1973
1973
  changeQueryData['shopId'] &&
1974
1974
  changeQueryData['shopId'] === 'undefined' &&
1975
1975
  delete changeQueryData['shopId'];
1976
1976
  changeQueryData['venderId'] &&
1977
1977
  changeQueryData['venderId'] === 'undefined' &&
1978
1978
  delete changeQueryData['venderId'];
1979
1979
  return changeQueryData;
1980
1980
  let isUsable = false;
1981
1981
  const modularPackResult = floorData?.floorExtInfo?.modularPackResult;
1982
1982
  const modularPackResultObj = formatPackResult(modularPackResult);
1983
1983
  const bundleUrl = getBundleUrl(modularPackResultObj);
1984
1984
  const bundleFileName = getBundleFileName(modularPackResultObj);
1985
1985
  const taroVersion = getTaroVersion(modularPackResultObj);
1986
1986
  if (bundleUrl && bundleFileName) {
1987
1987
  isUsable = true;
1988
1988
  }
1989
1989
  if (!isUsable && typeof exceptionReportFn === 'function') {
1990
1990
  exceptionReportFn({
1991
1991
  eventName: 'business',
1992
1992
  errorName: `${NO_ENVIRONMENT_AND_PAGE_TYPE_FLAG}${
1993
1993
  floorData?.floorExtInfo?.floorKind === FLOOR_KIND.PDC_SYSTEM_MODULE
1994
1994
  ? SgmCustomCode.SYSTEMPDCMODULE_DATA
1995
1995
  : SgmCustomCode.REMOTEMODULE_DATA
1996
1996
  }`,
1997
1997
  errorMessage: JSON.stringify({
1998
1998
  msg: `店铺h5楼层隐藏不显示。原因:模块数据不完备,楼层过滤。`,
1999
1999
  floorIdx: floorData?.floorIdx,
2000
2000
  uid: floorData?.uid,
2001
2001
  shopId: floorData?.floorExtInfo?.shopId,
2002
2002
  moduleId: floorData?.moduleId,
2003
2003
  moduleDesignerType: floorData?.floorExtInfo?.moduleDesignerType,
2004
2004
  floorLoadWay: floorData?.floorExtInfo?.floorLoadWay,
2005
2005
  floorKind: floorData?.floorExtInfo?.floorKind,
2006
2006
  middleTemplateId: floorData?.middleTemplateId,
2007
2007
  modularPackResult: {
2008
2008
  bundleUrl,
2009
2009
  taroVersion,
2010
2010
  },
2011
2011
  }),
2012
2012
  });
2013
2013
  }
2014
2014
  return isUsable;
2015
2015
  const containerObj = containerList.find((item) => item.containerId === containerId);
2016
2016
  const blacklistModules = ['chatgroup'];
2017
2017
  return blacklistModules.includes(containerObj?.typeCode);
2018
2018
  const objContainer = containerListData.find((item) => item.containerId === containerId);
2019
2019
  return (
2020
2020
  objContainer?.includeUids?.some((itemUid) => {
2021
2021
  const objectFloor = floorListData.find((floorItem) => itemUid === floorItem.uid);
2022
2022
  return RemoteLoadFloorList.includes(objectFloor?.floorExtInfo?.moduleFlag);
2023
2023
  }) ?? false
2024
2024
  );
2025
2025
  const unableIsvFloorListData = floorListData.filter(
2026
2026
  (floorItem) =>
2027
2027
  RemoteLoadFloorList.includes(floorItem?.floorExtInfo?.moduleFlag) &&
2028
2028
  !isIsvFloorUseable(floorItem, exceptionReportFn),
2029
2029
  );
2030
2030
  const unableIsvFloorUidList = unableIsvFloorListData.map((floorItem) => floorItem.uid);
2031
2031
  const unableIsvContainerListData = containerListData.filter(
2032
2032
  (item) =>
2033
2033
  item.includeUids &&
2034
2034
  item.includeUids.every((itemUid) => unableIsvFloorUidList.indexOf(itemUid) != -1),
2035
2035
  );
2036
2036
  return unableIsvContainerListData;
2037
2037
  console.log('暂无对应渠道比较', compareVersion, nowVersion);
2038
2038
  return -2;
2039
2039
  return customObj;
2040
2040
  return customObj;
2041
2041
  return customObj;
2042
2042
  return customObj;
2043
2043
  return customObj;
2044
2044
  return /openApp\.jdMobile:\/\/virtual\?params=/i.test(openAppUrl);
2045
2045
  let getParams = false;
2046
2046
  if (isOpenJdAppUrl(openAppUrl)) {
2047
2047
  try {
2048
2048
  getParams = openAppUrl.replace(/openApp\.jdMobile:\/\/virtual\?params=/i, '');
2049
2049
  getParams = JSON.parse(String(getParams));
2050
2050
  } catch (e) {
2051
2051
  console.log(e);
2052
2052
  }
2053
2053
  }
2054
2054
  return getParams;
2055
2055
  const getLastParams = Object.assign({}, openParams);
2056
2056
  return `openapp.jdmobile://virtual?params=${JSON.stringify(getLastParams)}`;
2057
2057
  if (val === null || val === '' || typeof val === 'undefined') {
2058
2058
  return true;
2059
2059
  }
2060
2060
  return false;
2061
2061
  const {
2062
2062
  moduleId = 'none',
2063
2063
  entrance = 'none',
2064
2064
  sourceType = 'none',
2065
2065
  sourceValue = 'none',
2066
2066
  } = params;
2067
2067
  if (isIosDevice) {
2068
2068
  return `${moduleId}#${entrance}`;
2069
2069
  } else if (isAndroidDevice) {
2070
2070
  return `${sourceType}#${sourceValue}`;
2071
2071
  }
2072
2072
  return 'none#none';
2073
2073
  if (data && typeof data === 'object') {
2074
2074
  let getOpenAppData = { ...data };
2075
2075
  try {
2076
2076
  const { sourceInfo, designerId, templateId, source } = getOpenAppData;
2077
2077
  if (designerId && templateId) {
2078
2078
  getOpenAppData = Object.assign({}, getOpenAppData, {
2079
2079
  sourceInfo: {
2080
2080
  entrance: '设计师预览',
2081
2081
  },
2082
2082
  });
2083
2083
  } else if (sourceInfo) {
2084
2084
  const { entrance } = sourceInfo;
2085
2085
  getOpenAppData.sourceInfo.entrance = entrance && entrance.length > 0 ? entrance : '其他';
2086
2086
  } else if (source && !sourceInfo) {
2087
2087
  if (typeof source === 'object') {
2088
2088
  const { sourceType, entrance, sourceValue, moduleId } = source;
2089
2089
  getOpenAppData = Object.assign({}, getOpenAppData, {
2090
2090
  sourceInfo: {
2091
2091
  entrance: sourceType || entrance || '其他',
2092
2092
  moduleId: sourceValue || moduleId || '-100',
2093
2093
  },
2094
2094
  });
2095
2095
  if (sourceType === 'shop_from_product_detail' && sourceValue) {
2096
2096
  getOpenAppData.sourceSku = sourceValue;
2097
2097
  }
2098
2098
  } else {
2099
2099
  getOpenAppData = Object.assign({}, getOpenAppData, {
2100
2100
  sourceInfo: {
2101
2101
  entrance: source,
2102
2102
  },
2103
2103
  });
2104
2104
  }
2105
2105
  } else {
2106
2106
  getOpenAppData = Object.assign({}, getOpenAppData, {
2107
2107
  sourceInfo: {
2108
2108
  entrance: '其他',
2109
2109
  },
2110
2110
  });
2111
2111
  }
2112
2112
  } catch (e) {
2113
2113
  console.log(e);
2114
2114
  }
2115
2115
  return getOpenAppData;
2116
2116
  }
2117
2117
  return data;
2118
2118
  return displayObj;
2119
2119
  if (typeof input === 'string') {
2120
2120
  try {
2121
2121
  return JSON.parse(input);
2122
2122
  } catch (e) {
2123
2123
  console.error('JSON解析失败', e);
2124
2124
  return {};
2125
2125
  }
2126
2126
  }
2127
2127
  return input || {};
2128
2128
  return false;
2129
2129
  const borderStyle: { [key: string]: any } = {};
2130
2130
  if (item?.borderRadius) {
2131
2131
  let borderTopRadius = 0;
2132
2132
  let borderBottomRadius = 0;
2133
2133
  if (index === 0) {
2134
2134
  borderTopRadius = item.borderRadius;
2135
2135
  borderBottomRadius = floorDataLen === 1 || item?.marginBottom !== 0 ? item.borderRadius : 0;
2136
2136
  } else if (index === floorDataLen - 1) {
2137
2137
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
2138
2138
  borderBottomRadius = item.borderRadius;
2139
2139
  } else {
2140
2140
  borderTopRadius = floorData[index - 1]?.marginBottom === 0 ? 0 : item.borderRadius;
2141
2141
  borderBottomRadius = item?.marginBottom === 0 ? 0 : item.borderRadius;
2142
2142
  }
2143
2143
  borderStyle.borderTopLeftRadius = item?.borderTopLeftRadius
2144
2144
  ? `${item?.borderTopLeftRadius}px`
2145
2145
  : `${borderTopRadius}px`;
2146
2146
  borderStyle.borderTopRightRadius = item?.borderTopRightRadius
2147
2147
  ? `${item?.borderTopRightRadius}px`
2148
2148
  : `${borderTopRadius}px`;
2149
2149
  borderStyle.borderBottomLeftRadius = `${borderBottomRadius}px`;
2150
2150
  borderStyle.borderBottomRightRadius = `${borderBottomRadius}px`;
2151
2151
  } else {
2152
2152
  borderStyle.borderTopLeftRadius = borderStyle?.borderTopLeftRadius || '0px';
2153
2153
  borderStyle.borderTopRightRadius = borderStyle?.borderTopRightRadius || '0px';
2154
2154
  borderStyle.borderBottomRightRadius = borderStyle?.borderBottomRightRadius || '0px';
2155
2155
  borderStyle.borderBottomLeftRadius = borderStyle?.borderBottomLeftRadius || '0px';
2156
2156
  }
2157
2157
  return borderStyle;
2158
2158
  isJdApp,
2159
2159
  isWxApp,
2160
2160
  isAscfApp,
2161
2161
  isIosDevice,
2162
2162
  isAndroidDevice,
2163
2163
  isJdAndIosDevice,
2164
2164
  isJdAndAndroidDevice,
2165
2165
  isWxMin,
2166
2166
  isWxMinAndWxapp,
2167
2167
  isJdMin,
2168
2168
  isMin,
2169
2169
  isJdMinAndHarmony,
2170
2170
  isH5,
2171
2171
  isH5AndJdShopView,
2172
2172
  isImageOptimizeEnable,
2173
2173
  isChartH5,
2174
2174
  isH5AndJdShopViewNativeScroll,
2175
2175
  isH5AndJdShopViewH5Scroll,
2176
2176
  isH5AndJdShopH5CustomScrollView,
2177
2177
  isWxMiniH5View,
2178
2178
  sliceArrToChunkList,
2179
2179
  dealAddress,
2180
2180
  objectToUrlEncode,
2181
2181
  parseQueryUrlString,
2182
2182
  setLowSmallPicUrl,
2183
2183
  getJfsImage,
2184
2184
  getQualityImage,
2185
2185
  countStringify,
2186
2186
  setTaroStorage,
2187
2187
  getTaroStorageKeyValue,
2188
2188
  removeTaroStorageKey,
2189
2189
  clearTaroStorageKey,
2190
2190
  getSystemInfos,
2191
2191
  addHttps,
2192
2192
  dateFormat,
2193
2193
  throttle,
2194
2194
  lodashThrottle,
2195
2195
  debounce,
2196
2196
  getTelephone,
2197
2197
  rgbToHex,
2198
2198
  hexToRgb,
2199
2199
  getRandom,
2200
2200
  getWxAppCookieStr,
2201
2201
  pxTransformFromData,
2202
2202
  dealShopContentData,
2203
2203
  showSuccessToast,
2204
2204
  showFailToast,
2205
2205
  showNormalToast,
2206
2206
  showShopLoading,
2207
2207
  hideShopLoading,
2208
2208
  getAppChannelType,
2209
2209
  formatTabActiveMenuType,
2210
2210
  filterUrlQueryData,
2211
2211
  getAvifSupport,
2212
2212
  getWebpSupport,
2213
2213
  isMemberPage,
2214
2214
  draCustomReport,
2215
2215
  remoteCustomReport,
2216
2216
  draInterfaceCustomReport,
2217
2217
  draBusinessCustomReport,
2218
2218
  draBusinessCustomLogReport,
2219
2219
  isOpenJdAppUrl,
2220
2220
  jdOpenAppParams,
2221
2221
  createJdOpenAppUrl,
2222
2222
  dealJdOpenAppData,
2223
2223
  isEmpty,
2224
2224
  getJdAppReportPageSource,
2225
2225
  isAppClassifyPage,
2226
2226
  getQualityImageNew,
2227
2227
  getQualityImageOld,
2228
2228
  isPc,
2229
2229
  isPcClassifyPage,
2230
2230
  ipLoc_djd,
2231
2231
  jdAppVersionCompare,
2232
2232
  dealNativePixelToCssPixel,
2233
2233
  isAppStowShop,
2234
2234
  isIpadDevice,
2235
2235
  getBorderStyle,
2236
2236
  isLanguageForEn,
2237
2237
  sColor,
2238
2238
  isTabletDevice,
2239
2239
  isInHarmonyBlacklistByModuleFlag,
2240
2240
  isJdLiteApp,
2241
2241
  isJdAppForNotMain,