@conecli/cone-render 0.10.1-shop3.9 → 0.10.1-shop3.91

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