@conecli/cone-render 0.10.1-shop3.10 → 0.10.1-shop3.101

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