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

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